pNet-DNS 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. data/README +68 -0
  2. data/lib/Net/DNS.rb +879 -0
  3. data/lib/Net/DNS/Header.rb +303 -0
  4. data/lib/Net/DNS/Nameserver.rb +601 -0
  5. data/lib/Net/DNS/Packet.rb +851 -0
  6. data/lib/Net/DNS/Question.rb +117 -0
  7. data/lib/Net/DNS/RR.rb +630 -0
  8. data/lib/Net/DNS/RR/A.rb +103 -0
  9. data/lib/Net/DNS/RR/AAAA.rb +147 -0
  10. data/lib/Net/DNS/RR/AFSDB.rb +114 -0
  11. data/lib/Net/DNS/RR/CERT.rb +191 -0
  12. data/lib/Net/DNS/RR/CNAME.rb +89 -0
  13. data/lib/Net/DNS/RR/DNAME.rb +84 -0
  14. data/lib/Net/DNS/RR/EID.rb +70 -0
  15. data/lib/Net/DNS/RR/HINFO.rb +108 -0
  16. data/lib/Net/DNS/RR/ISDN.rb +118 -0
  17. data/lib/Net/DNS/RR/LOC.rb +341 -0
  18. data/lib/Net/DNS/RR/MB.rb +92 -0
  19. data/lib/Net/DNS/RR/MG.rb +96 -0
  20. data/lib/Net/DNS/RR/MINFO.rb +109 -0
  21. data/lib/Net/DNS/RR/MR.rb +92 -0
  22. data/lib/Net/DNS/RR/MX.rb +124 -0
  23. data/lib/Net/DNS/RR/NAPTR.rb +182 -0
  24. data/lib/Net/DNS/RR/NIMLOC.rb +70 -0
  25. data/lib/Net/DNS/RR/NS.rb +100 -0
  26. data/lib/Net/DNS/RR/NSAP.rb +273 -0
  27. data/lib/Net/DNS/RR/NULL.rb +68 -0
  28. data/lib/Net/DNS/RR/OPT.rb +251 -0
  29. data/lib/Net/DNS/RR/PTR.rb +93 -0
  30. data/lib/Net/DNS/RR/PX.rb +131 -0
  31. data/lib/Net/DNS/RR/RP.rb +108 -0
  32. data/lib/Net/DNS/RR/RT.rb +115 -0
  33. data/lib/Net/DNS/RR/SOA.rb +195 -0
  34. data/lib/Net/DNS/RR/SPF.rb +46 -0
  35. data/lib/Net/DNS/RR/SRV.rb +153 -0
  36. data/lib/Net/DNS/RR/SSHFP.rb +190 -0
  37. data/lib/Net/DNS/RR/TKEY.rb +219 -0
  38. data/lib/Net/DNS/RR/TSIG.rb +358 -0
  39. data/lib/Net/DNS/RR/TXT.rb +162 -0
  40. data/lib/Net/DNS/RR/UNKNOWN.rb +76 -0
  41. data/lib/Net/DNS/RR/X25.rb +90 -0
  42. data/lib/Net/DNS/Resolver.rb +2090 -0
  43. data/lib/Net/DNS/Resolver/Recurse.rb +478 -0
  44. data/lib/Net/DNS/Update.rb +189 -0
  45. data/test/custom.txt +4 -0
  46. data/test/resolv.conf +4 -0
  47. data/test/tc_escapedchars.rb +498 -0
  48. data/test/tc_header.rb +91 -0
  49. data/test/tc_inet6.rb +169 -0
  50. data/test/tc_misc.rb +137 -0
  51. data/test/tc_online.rb +236 -0
  52. data/test/tc_packet.rb +174 -0
  53. data/test/tc_packet_unique_push.rb +126 -0
  54. data/test/tc_question.rb +49 -0
  55. data/test/tc_recurse.rb +69 -0
  56. data/test/tc_res_env.rb +59 -0
  57. data/test/tc_res_file.rb +55 -0
  58. data/test/tc_res_opt.rb +135 -0
  59. data/test/tc_resolver.rb +102 -0
  60. data/test/tc_rr-opt.rb +40 -0
  61. data/test/tc_rr-rrsort.rb +116 -0
  62. data/test/tc_rr-txt.rb +138 -0
  63. data/test/tc_rr-unknown.rb +95 -0
  64. data/test/tc_rr.rb +246 -0
  65. data/test/tc_tcp.rb +34 -0
  66. data/test/tc_tkey.rb +115 -0
  67. data/test/tc_update.rb +226 -0
  68. data/test/ts_netdns.rb +17 -0
  69. data/test/ts_offline.rb +32 -0
  70. data/test/ts_online.rb +33 -0
  71. metadata +119 -0
@@ -0,0 +1,174 @@
1
+ # The contents of this file are subject to the Mozilla
2
+ # Public Licence Version 1.1 (the "Licence"); you may
3
+ # not use this file except in compliance with the
4
+ # Licence. You may obtain a copy of the Licence at
5
+ # http://www.mozilla.org/MPL
6
+ # Software distributed under the Licence is distributed
7
+ # on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
8
+ # either express or implied. See the Licence of the
9
+ # specific language governing rights and limitations
10
+ # under the Licence.
11
+ # The Original Code is pNet::DNS.
12
+ # The Initial Developer of the Original Code is
13
+ # Nominet UK (www.nominet.org.uk). Portions created by
14
+ # Nominet UK are Copyright (c) Nominet UK 2006.
15
+ # All rights reserved.
16
+ require 'test/unit'
17
+ require 'Net/DNS'
18
+ class TestPacket < Test::Unit::TestCase
19
+ def test_packet
20
+ domain = "example.com"
21
+ type = "MX"
22
+ klass = "IN"
23
+
24
+ packet = Net::DNS::Packet.new_from_values(domain, type, klass)
25
+
26
+ assert(packet, 'new() returned something'); #2
27
+ assert(packet.header, 'header() method works'); #3
28
+ assert_instance_of(Net::DNS::Header,packet.header,'header() returns right thing'); #4
29
+
30
+
31
+ question = packet.question;
32
+ assert(question && question.length == 1, 'question() returned right number of items'); #5
33
+ assert_instance_of(Net::DNS::Question,question[0], 'question() returned the right thing'); #6
34
+
35
+
36
+ answer = packet.answer;
37
+ assert(answer.length == 0, 'answer() works when empty'); #7
38
+
39
+
40
+ authority = packet.authority;
41
+ assert(authority.length == 0, 'authority() works when empty'); #8
42
+
43
+ additional = packet.additional;
44
+ assert(additional.length == 0, 'additional() works when empty'); #9
45
+
46
+ packet.push(:answer, Net::DNS::RR.create( {
47
+ :name => "a1.example.com",
48
+ :type => "A",
49
+ :address => "10.0.0.1"}));
50
+ assert_equal(1, packet.header.ancount, 'First push into answer section worked'); #10
51
+
52
+
53
+ packet.push(:answer, Net::DNS::RR.create({:name => "a2.example.com",
54
+ :type => "A", :address => "10.0.0.2"}));
55
+ assert_equal(packet.header.ancount, 2, 'Second push into answer section worked'); #11
56
+
57
+
58
+ packet.push(:authority, Net::DNS::RR.create({:name => "a3.example.com",
59
+ :type => "A",
60
+ :address => "10.0.0.3"}));
61
+ assert_equal(1, packet.header.nscount, 'First push into authority section worked'); #12
62
+
63
+
64
+ packet.push(:authority, Net::DNS::RR.create( {
65
+ :name => "a4.example.com",
66
+ :type => "A",
67
+ :address => "10.0.0.4"}));
68
+ assert_equal(2, packet.header.nscount, 'Second push into authority section worked'); #13
69
+
70
+ packet.push(:additional, Net::DNS::RR.create({
71
+ :name => "a5.example.com",
72
+ :type => "A",
73
+ :address => "10.0.0.5"}));
74
+ assert_equal(1, packet.header.adcount, 'First push into additional section worked'); #14
75
+
76
+ packet.push(:additional, Net::DNS::RR.create( {
77
+ :name => "a6.example.com",
78
+ :type => "A",
79
+ :address => "10.0.0.6"}));
80
+ assert_equal(2, packet.header.adcount, 'Second push into additional section worked'); #15
81
+
82
+ data = packet.data;
83
+
84
+ packet2 = Net::DNS::Packet.new_from_binary(data);
85
+
86
+ assert(packet2, 'new() from data buffer works'); #16
87
+
88
+ assert_equal(packet.inspect, packet2.inspect, 'inspect() works correctly'); #17
89
+
90
+
91
+ string = packet2.inspect
92
+ 6.times do |count|
93
+ ip = "10.0.0.#{count+1}";
94
+ assert(string =~ /#{ip}/, "Found #{ip} in packet"); # 18 though 23
95
+ end
96
+
97
+ assert_equal(1, packet2.header.qdcount, 'header question count correct'); #24
98
+ assert_equal(2, packet2.header.ancount, 'header answer count correct'); #25
99
+ assert_equal(2, packet2.header.nscount, 'header authority count correct'); #26
100
+ assert_equal(2, packet2.header.adcount, 'header additional count correct'); #27
101
+
102
+
103
+
104
+ # Test using a predefined answer. This is an answer that was generated by a bind server.
105
+ #
106
+
107
+ # data=["22cc85000001000000010001056461636874036e657400001e0001c00c0006000100000e100025026e730472697065c012046f6c6166c02a7754e1ae0000a8c0000038400005460000001c2000002910000000800000050000000030"].pack("H*");
108
+ uuencodedPacket =%w{
109
+ 22 cc 85 00 00 01 00 00 00 01 00 01 05 64 61 63
110
+ 68 74 03 6e 65 74 00 00 1e 00 01 c0 0c 00 06 00
111
+ 01 00 00 0e 10 00 25 02 6e 73 04 72 69 70 65 c0
112
+ 12 04 6f 6c 61 66 c0 2a 77 54 e1 ae 00 00 a8 c0
113
+ 00 00 38 40 00 05 46 00 00 00 1c 20 00 00 29 10
114
+ 00 00 00 80 00 00 05 00 00 00 00 30
115
+ }
116
+ uuencodedPacket.map!{|e| e.hex}
117
+ packetdata = uuencodedPacket.pack('c*')
118
+
119
+ # packet3 = Net::DNS::Packet.new_from_binary(data);
120
+ packet3 = Net::DNS::Packet.new_from_binary(packetdata);
121
+ assert(packet3, 'new(\data) returned something'); #28
122
+
123
+ assert_equal(packet3.header.qdcount, 1, 'header question count in syntetic packet correct'); #29
124
+ assert_equal(packet3.header.ancount, 0, 'header answer count in syntetic packet correct'); #30
125
+ assert_equal(packet3.header.nscount, 1, 'header authority count in syntetic packet correct'); #31
126
+ assert_equal(packet3.header.adcount, 1, 'header additional in sytnetic packet correct'); #32
127
+
128
+ rr=packet3.additional;
129
+
130
+ assert_equal('OPT', rr[0].type, "Additional section packet is EDNS0 type"); #33
131
+ assert_equal(4096, rr[0].rrclass, "EDNS0 packet size correct"); #34
132
+
133
+ question2=Net::DNS::Question.new("bla.foo",'TXT','CHAOS');
134
+ assert_instance_of(Net::DNS::Question,question2,"Proper type of object created"); #35
135
+
136
+ # In theory its valid to have multiple questions in the question section.
137
+ # Not many servers digest it though.
138
+
139
+ packet.push(:question, question2);
140
+ question = packet.question;
141
+ assert_equal(2, question.length, 'question() returned right number of items poptest:2'); #36
142
+
143
+
144
+ packet.pop(:question);
145
+
146
+ question = packet.question;
147
+ assert_equal(1, question.length, 'question() returned right number of items poptest:1'); #37
148
+
149
+ packet.pop(:question);
150
+
151
+ question = packet.question;
152
+
153
+
154
+ assert_equal(0, question.length, 'question() returned right number of items poptest0'); #38
155
+
156
+ end
157
+
158
+
159
+ def test_push
160
+ packet=Net::DNS::Packet.new_from_values("254.9.11.10.in-addr.arpa","PTR","IN");
161
+
162
+ packet.push(:answer, Net::DNS::RR.create(%q[254.9.11.10.in-addr.arpa 86400 IN PTR host-84-11-9-254.customer.example.com]));
163
+
164
+ packet.push(:authority, Net::DNS::RR.create("9.11.10.in-addr.arpa 86400 IN NS autons1.example.com"));
165
+ packet.push(:authority, Net::DNS::RR.create("9.11.10.in-addr.arpa 86400 IN NS autons2.example.com"));
166
+ packet.push(:authority, Net::DNS::RR.create("9.11.10.in-addr.arpa 86400 IN NS autons3.example.com"));
167
+
168
+ data=packet.data;
169
+ packet2=Net::DNS::Packet.new_from_binary(data);
170
+
171
+ assert_equal(packet.inspect,packet2.inspect,"Packet to data and back (failure indicates brasserten dn_comp)"); #39
172
+
173
+ end
174
+ end
@@ -0,0 +1,126 @@
1
+ # The contents of this file are subject to the Mozilla
2
+ # Public Licence Version 1.1 (the "Licence"); you may
3
+ # not use this file except in compliance with the
4
+ # Licence. You may obtain a copy of the Licence at
5
+ # http://www.mozilla.org/MPL
6
+ # Software distributed under the Licence is distributed
7
+ # on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
8
+ # either express or implied. See the Licence of the
9
+ # specific language governing rights and limitations
10
+ # under the Licence.
11
+ # The Original Code is pNet::DNS.
12
+ # The Initial Developer of the Original Code is
13
+ # Nominet UK (www.nominet.org.uk). Portions created by
14
+ # Nominet UK are Copyright (c) Nominet UK 2006.
15
+ # All rights reserved.
16
+ require 'test/unit'
17
+ require 'Net/DNS'
18
+ class TestPacketUniquePush < Test::Unit::TestCase
19
+ def test_packUniquePush
20
+
21
+
22
+ testProc('unique_push');
23
+ end
24
+
25
+ def test_packetSafePush
26
+ # @todo RESTORE THIS
27
+ #~ @warnings;
28
+ #~ local $SIG{__WARN__} = sub { push(@warnings, "@_"); };
29
+ begin
30
+ testProc('safe_push');
31
+ flunk("Shouldn't work!")
32
+ rescue Exception
33
+ end
34
+
35
+ #~ assert(scalar @warnings, 72);
36
+
37
+ #~ ok(!grep { $_ !~ m/deprecated/ } @warnings);
38
+
39
+
40
+
41
+ end
42
+
43
+ def testProc (method)
44
+ domain = 'example.com';
45
+
46
+ tests = [
47
+ [
48
+ 1,
49
+ Net::DNS::RR.create('foo.example.com 60 IN A 10.0.0.1'),
50
+ Net::DNS::RR.create('foo.example.com 60 IN A 10.0.0.1'),
51
+ ],
52
+ [
53
+ 2,
54
+ Net::DNS::RR.create('foo.example.com 60 IN A 10.0.0.1'),
55
+ Net::DNS::RR.create('bar.example.com 60 IN A 10.0.0.1'),
56
+ ],
57
+ [
58
+ 2,
59
+ Net::DNS::RR.create('foo.example.com 60 IN A 10.0.0.1'),
60
+ Net::DNS::RR.create('foo.example.com 60 IN A 10.0.0.1'),
61
+ Net::DNS::RR.create('foo.example.com 90 IN A 10.0.0.1'),
62
+ ],
63
+ [
64
+ 3,
65
+ Net::DNS::RR.create('foo.example.com 60 IN A 10.0.0.1'),
66
+ Net::DNS::RR.create('foo.example.com 60 IN A 10.0.0.2'),
67
+ Net::DNS::RR.create('foo.example.com 60 IN A 10.0.0.3'),
68
+ ],
69
+ [
70
+ 3,
71
+ Net::DNS::RR.create('foo.example.com 60 IN A 10.0.0.1'),
72
+ Net::DNS::RR.create('foo.example.com 60 IN A 10.0.0.2'),
73
+ Net::DNS::RR.create('foo.example.com 60 IN A 10.0.0.3'),
74
+ Net::DNS::RR.create('foo.example.com 60 IN A 10.0.0.1'),
75
+ ],
76
+ [
77
+ 3,
78
+ Net::DNS::RR.create('foo.example.com 60 IN A 10.0.0.1'),
79
+ Net::DNS::RR.create('foo.example.com 60 IN A 10.0.0.2'),
80
+ Net::DNS::RR.create('foo.example.com 60 IN A 10.0.0.1'),
81
+ Net::DNS::RR.create('foo.example.com 60 IN A 10.0.0.4'),
82
+ ],
83
+ ]
84
+
85
+ sections = {
86
+ 'answer' => 'ancount',
87
+ 'authority' => 'nscount',
88
+ 'additional' => 'arcount',
89
+ }
90
+
91
+ tests.each do | try |
92
+ count = try.shift;
93
+ rrs = try;
94
+
95
+ sections.each do |section, count_meth|
96
+
97
+ packet = Net::DNS::Packet.new_from_values(domain);
98
+
99
+ packet.send(method,section, rrs);
100
+
101
+ assert_equal(count, packet.header.send(count_meth), "#{section} right for #{rrs.inspect}");
102
+
103
+ end
104
+
105
+ #
106
+ # Now do it again calling safe_push() for each RR.
107
+ #
108
+ sections.each do |section, count_meth|
109
+
110
+ packet = Net::DNS::Packet.new_from_values(domain);
111
+
112
+ # foreach (rrs) {
113
+ # if rrs.class == Net::DNS::RR
114
+ # packet.send(method,section, rrs);
115
+ # else
116
+ rrs.each do |rr|
117
+ packet.send(method,section, [rr]);
118
+ end
119
+ # end
120
+ # }
121
+
122
+ assert_equal(count, packet.header.send(count_meth), "#{section} right for #{rrs.inspect}");
123
+ end
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,49 @@
1
+ # The contents of this file are subject to the Mozilla
2
+ # Public Licence Version 1.1 (the "Licence"); you may
3
+ # not use this file except in compliance with the
4
+ # Licence. You may obtain a copy of the Licence at
5
+ # http://www.mozilla.org/MPL
6
+ # Software distributed under the Licence is distributed
7
+ # on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
8
+ # either express or implied. See the Licence of the
9
+ # specific language governing rights and limitations
10
+ # under the Licence.
11
+ # The Original Code is pNet::DNS.
12
+ # The Initial Developer of the Original Code is
13
+ # Nominet UK (www.nominet.org.uk). Portions created by
14
+ # Nominet UK are Copyright (c) Nominet UK 2006.
15
+ # All rights reserved.
16
+ require 'test/unit'
17
+ require 'Net/DNS'
18
+ class TestQuestion < Test::Unit::TestCase
19
+ def test_question
20
+ domain = "example.com"
21
+ type = "MX"
22
+ klass = "IN"
23
+
24
+ q = Net::DNS::Question.new(domain, type, klass)
25
+ assert(q, "new() returned something")
26
+ assert_equal(q.qname, domain, "qName()")
27
+ assert_equal(q.qtype, type, "qType()")
28
+ assert_equal(q.qclass, klass, "qClass()")
29
+
30
+ #
31
+ # Check the aliases
32
+ #
33
+ assert_equal(q.zname, domain, 'zName()' );
34
+ assert_equal(q.ztype, type, 'zType()' );
35
+ assert_equal(q.zclass, klass, 'zClass()' );
36
+
37
+ #
38
+ # Check that we can change stuff
39
+ #
40
+ q.qname=('example.net');
41
+ q.qtype=('A');
42
+ q.qclass=('CH');
43
+
44
+ assert_equal(q.qname, 'example.net', 'qName()' );
45
+ assert_equal(q.qtype, 'A', 'qType()' );
46
+ assert_equal(q.qclass, 'CH', 'qClass()' );
47
+
48
+ end
49
+ end
@@ -0,0 +1,69 @@
1
+ # The contents of this file are subject to the Mozilla
2
+ # Public Licence Version 1.1 (the "Licence"); you may
3
+ # not use this file except in compliance with the
4
+ # Licence. You may obtain a copy of the Licence at
5
+ # http://www.mozilla.org/MPL
6
+ # Software distributed under the Licence is distributed
7
+ # on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
8
+ # either express or implied. See the Licence of the
9
+ # specific language governing rights and limitations
10
+ # under the Licence.
11
+ # The Original Code is pNet::DNS.
12
+ # The Initial Developer of the Original Code is
13
+ # Nominet UK (www.nominet.org.uk). Portions created by
14
+ # Nominet UK are Copyright (c) Nominet UK 2006.
15
+ # All rights reserved.
16
+ require 'test/unit'
17
+ require 'Net/DNS'
18
+ require 'Net/DNS/Resolver/Recurse'
19
+ class TestRecurse < Test::Unit::TestCase
20
+
21
+ def test_recurse
22
+ res = Net::DNS::Resolver::Recurse.new
23
+ res.force_v4 = true
24
+
25
+ assert_instance_of(Net::DNS::Resolver::Recurse, res)
26
+
27
+ res.debug=false
28
+ res.udp_timeout=(20)
29
+
30
+ setHints(res)
31
+
32
+ # Try a domain that is a CNAME
33
+ packet = res.query_dorecursion("www.netscape.com.",'A')
34
+ assert(packet, 'got a packet')
35
+ assert(packet.answer, 'answer has RRs')
36
+
37
+ # Try a big hairy one
38
+ packet = nil
39
+ packet = res.query_dorecursion("www.rob.com.au.",'A')
40
+ print packet.inspect
41
+ assert(packet, 'got a packet')
42
+ assert(packet.answer, 'anwer section had RRs')
43
+ end
44
+
45
+ def test_callback
46
+ # test the callback
47
+ res = Net::DNS::Resolver::Recurse.new
48
+ res.force_v4 = true
49
+ setHints(res)
50
+ count=0
51
+
52
+
53
+ res.recursion_callback = Proc.new { |packet| assert_instance_of(Net::DNS::Packet, packet)
54
+ count = count + 1
55
+ }
56
+
57
+ ret = res.query_dorecursion('a.t.net-dns.org', 'A')
58
+ # print ret.inspect
59
+
60
+ assert_equal(3, count)
61
+ end
62
+
63
+ def setHints(res)
64
+ # Hard code A and K.ROOT-SERVERS.NET hint
65
+ res.hints=(["193.0.14.129", "198.41.0.4"])
66
+
67
+ assert(res.hints.length>0, 'hints set')
68
+ end
69
+ end
@@ -0,0 +1,59 @@
1
+ # The contents of this file are subject to the Mozilla
2
+ # Public Licence Version 1.1 (the "Licence"); you may
3
+ # not use this file except in compliance with the
4
+ # Licence. You may obtain a copy of the Licence at
5
+ # http://www.mozilla.org/MPL
6
+ # Software distributed under the Licence is distributed
7
+ # on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
8
+ # either express or implied. See the Licence of the
9
+ # specific language governing rights and limitations
10
+ # under the Licence.
11
+ # The Original Code is pNet::DNS.
12
+ # The Initial Developer of the Original Code is
13
+ # Nominet UK (www.nominet.org.uk). Portions created by
14
+ # Nominet UK are Copyright (c) Nominet UK 2006.
15
+ # All rights reserved.
16
+ require 'test/unit'
17
+ require 'Net/DNS'
18
+ class TestResolverEnv < Test::Unit::TestCase
19
+ def test_res_env
20
+ ENV['RES_NAMESERVERS'] = '10.0.1.128 10.0.2.128';
21
+ ENV['RES_SEARCHLIST'] = 'net-dns.org lib.net-dns.org';
22
+ ENV['LOCALDOMAIN'] = 't.net-dns.org';
23
+ ENV['RES_OPTIONS'] = 'retrans:3 retry:2 debug';
24
+
25
+
26
+ res = Net::DNS::Resolver.new;
27
+
28
+ assert(res, "new() returned something");
29
+ assert(res.nameservers, "nameservers() works");
30
+
31
+ servers = res.nameservers;
32
+
33
+ assert_equal(servers[0], '10.0.1.128', 'Nameserver set correctly');
34
+ assert_equal(servers[1], '10.0.2.128', 'Nameserver set correctly');
35
+
36
+
37
+ search = res.searchlist;
38
+ assert_equal(search[0], 'net-dns.org', 'Search set correctly' );
39
+ assert_equal(search[1], 'lib.net-dns.org', 'Search set correctly' );
40
+
41
+ assert_equal(res.domain, 't.net-dns.org', 'Local domain works' );
42
+ assert_equal(3, res.retrans, 'Retransmit works' );
43
+ assert_equal(2, res.retry, 'Retry works' );
44
+ assert(res.debug, 'Debug works' );
45
+
46
+
47
+
48
+
49
+ # @TODO Get these tests working!!
50
+ # eval('$Net::DNS::DNSSEC=0; \
51
+ # local $SIG{__WARN__}=sub { ok ($_[0]=~/You called the Net::DNS::Resolver::dnssec\(\)/, "Correct warning in absense of Net::DNS::SEC") }; \
52
+ # res.dnssec(1);')
53
+ #
54
+ # eval('$Net::DNS::DNSSEC=1; \
55
+ # local $SIG{__WARN__}=sub { diag "We are ignoring that Net::DNS::SEC not installed." }; \
56
+ # res.dnssec(1); \
57
+ # assert_equal(res.udppacketsize(),2048,"dnssec() sets udppacketsize to 2048");')
58
+ end
59
+ end