dnsruby 1.55 → 1.56.0
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.
- checksums.yaml +4 -4
- data/README.md +96 -0
- data/Rakefile +30 -29
- data/demo/axfr.rb +93 -93
- data/demo/check_soa.rb +99 -99
- data/demo/check_zone.rb +59 -59
- data/demo/digdlv.rb +43 -43
- data/demo/digroot.rb +34 -34
- data/demo/example_recurse.rb +14 -14
- data/demo/mresolv.rb +30 -30
- data/demo/mx.rb +31 -31
- data/demo/rubydig.rb +37 -37
- data/demo/to_resolve.txt +3088 -3088
- data/demo/trace_dns.rb +46 -46
- data/lib/dnsruby.rb +161 -526
- data/lib/dnsruby/DNS.rb +305 -0
- data/lib/{Dnsruby/Cache.rb → dnsruby/cache.rb} +152 -152
- data/lib/{Dnsruby → dnsruby}/code_mapper.rb +48 -52
- data/lib/dnsruby/code_mappers.rb +295 -0
- data/lib/{Dnsruby/Config.rb → dnsruby/config.rb} +454 -454
- data/lib/{Dnsruby → dnsruby}/dnssec.rb +91 -91
- data/lib/{Dnsruby/Hosts.rb → dnsruby/hosts.rb} +125 -125
- data/lib/{Dnsruby → dnsruby}/ipv4.rb +26 -26
- data/lib/{Dnsruby → dnsruby}/ipv6.rb +42 -42
- data/lib/{Dnsruby → dnsruby}/key_cache.rb +29 -29
- data/lib/dnsruby/message/decoder.rb +164 -0
- data/lib/dnsruby/message/encoder.rb +75 -0
- data/lib/dnsruby/message/header.rb +249 -0
- data/lib/dnsruby/message/message.rb +629 -0
- data/lib/dnsruby/message/question.rb +86 -0
- data/lib/dnsruby/message/section.rb +96 -0
- data/lib/{Dnsruby → dnsruby}/name.rb +141 -141
- data/lib/dnsruby/packet_sender.rb +661 -0
- data/lib/{Dnsruby/Recursor.rb → dnsruby/recursor.rb} +235 -233
- data/lib/dnsruby/resolv.rb +113 -0
- data/lib/dnsruby/resolver.rb +1192 -0
- data/lib/dnsruby/resource/A.rb +56 -0
- data/lib/dnsruby/resource/AAAA.rb +54 -0
- data/lib/{Dnsruby → dnsruby}/resource/AFSDB.rb +68 -68
- data/lib/{Dnsruby → dnsruby}/resource/CERT.rb +105 -105
- data/lib/{Dnsruby → dnsruby}/resource/DHCID.rb +54 -54
- data/lib/dnsruby/resource/DLV.rb +27 -0
- data/lib/{Dnsruby → dnsruby}/resource/DNSKEY.rb +372 -372
- data/lib/{Dnsruby → dnsruby}/resource/DS.rb +255 -255
- data/lib/{Dnsruby → dnsruby}/resource/HINFO.rb +71 -71
- data/lib/{Dnsruby → dnsruby}/resource/HIP.rb +29 -29
- data/lib/{Dnsruby → dnsruby}/resource/IN.rb +30 -30
- data/lib/{Dnsruby → dnsruby}/resource/IPSECKEY.rb +31 -31
- data/lib/{Dnsruby → dnsruby}/resource/ISDN.rb +62 -62
- data/lib/{Dnsruby → dnsruby}/resource/KX.rb +65 -65
- data/lib/{Dnsruby → dnsruby}/resource/LOC.rb +263 -263
- data/lib/{Dnsruby → dnsruby}/resource/MINFO.rb +69 -69
- data/lib/{Dnsruby → dnsruby}/resource/MX.rb +65 -65
- data/lib/{Dnsruby → dnsruby}/resource/NAPTR.rb +98 -98
- data/lib/{Dnsruby → dnsruby}/resource/NSAP.rb +171 -171
- data/lib/dnsruby/resource/NSEC.rb +275 -0
- data/lib/dnsruby/resource/NSEC3.rb +332 -0
- data/lib/dnsruby/resource/NSEC3PARAM.rb +135 -0
- data/lib/dnsruby/resource/OPT.rb +272 -0
- data/lib/{Dnsruby → dnsruby}/resource/PX.rb +70 -70
- data/lib/{Dnsruby → dnsruby}/resource/RP.rb +75 -75
- data/lib/dnsruby/resource/RR.rb +421 -0
- data/lib/dnsruby/resource/RRSIG.rb +275 -0
- data/lib/dnsruby/resource/RRSet.rb +190 -0
- data/lib/{Dnsruby → dnsruby}/resource/RT.rb +67 -67
- data/lib/{Dnsruby → dnsruby}/resource/SOA.rb +94 -94
- data/lib/dnsruby/resource/SPF.rb +29 -0
- data/lib/dnsruby/resource/SRV.rb +112 -0
- data/lib/{Dnsruby → dnsruby}/resource/SSHFP.rb +14 -14
- data/lib/dnsruby/resource/TKEY.rb +163 -0
- data/lib/dnsruby/resource/TSIG.rb +593 -0
- data/lib/{Dnsruby → dnsruby}/resource/TXT.rb +191 -191
- data/lib/dnsruby/resource/X25.rb +55 -0
- data/lib/{Dnsruby → dnsruby}/resource/domain_name.rb +25 -25
- data/lib/{Dnsruby → dnsruby}/resource/generic.rb +80 -80
- data/lib/dnsruby/resource/resource.rb +25 -0
- data/lib/{Dnsruby → dnsruby}/select_thread.rb +148 -148
- data/lib/{Dnsruby/SingleResolver.rb → dnsruby/single_resolver.rb} +60 -60
- data/lib/{Dnsruby → dnsruby}/single_verifier.rb +344 -344
- data/lib/dnsruby/the_log.rb +44 -0
- data/lib/dnsruby/update.rb +278 -0
- data/lib/dnsruby/validator_thread.rb +124 -0
- data/lib/dnsruby/version.rb +3 -0
- data/lib/{Dnsruby → dnsruby}/zone_reader.rb +93 -93
- data/lib/{Dnsruby → dnsruby}/zone_transfer.rb +377 -377
- data/test/spec_helper.rb +16 -0
- data/test/tc_axfr.rb +31 -34
- data/test/tc_cache.rb +32 -32
- data/test/tc_dlv.rb +28 -28
- data/test/tc_dns.rb +73 -76
- data/test/tc_dnskey.rb +31 -32
- data/test/tc_dnsruby.rb +50 -44
- data/test/tc_ds.rb +36 -36
- data/test/tc_escapedchars.rb +252 -255
- data/test/tc_hash.rb +17 -21
- data/test/tc_header.rb +48 -57
- data/test/tc_hip.rb +19 -22
- data/test/tc_ipseckey.rb +18 -21
- data/test/tc_keith.rb +300 -0
- data/test/tc_message.rb +87 -0
- data/test/tc_misc.rb +83 -87
- data/test/tc_name.rb +81 -84
- data/test/tc_naptr.rb +18 -21
- data/test/tc_nsec.rb +55 -55
- data/test/tc_nsec3.rb +23 -24
- data/test/tc_nsec3param.rb +20 -21
- data/test/tc_packet.rb +90 -93
- data/test/tc_packet_unique_push.rb +48 -51
- data/test/tc_question.rb +30 -33
- data/test/tc_queue.rb +16 -17
- data/test/tc_recur.rb +16 -17
- data/test/tc_res_config.rb +38 -41
- data/test/tc_res_env.rb +29 -32
- data/test/tc_res_file.rb +26 -29
- data/test/tc_res_opt.rb +62 -65
- data/test/tc_resolver.rb +287 -242
- data/test/tc_rr-opt.rb +70 -63
- data/test/tc_rr-txt.rb +68 -71
- data/test/tc_rr-unknown.rb +45 -48
- data/test/tc_rr.rb +76 -70
- data/test/tc_rrset.rb +21 -22
- data/test/tc_rrsig.rb +19 -20
- data/test/tc_single_resolver.rb +294 -297
- data/test/tc_soak.rb +199 -202
- data/test/tc_soak_base.rb +29 -34
- data/test/tc_sshfp.rb +20 -23
- data/test/tc_tcp.rb +32 -35
- data/test/tc_tkey.rb +41 -44
- data/test/tc_tsig.rb +81 -84
- data/test/tc_update.rb +108 -111
- data/test/tc_validator.rb +29 -29
- data/test/tc_verifier.rb +81 -82
- data/test/ts_dnsruby.rb +16 -15
- data/test/ts_offline.rb +62 -63
- data/test/ts_online.rb +115 -115
- metadata +155 -90
- data/README +0 -59
- data/lib/Dnsruby/DNS.rb +0 -305
- data/lib/Dnsruby/PacketSender.rb +0 -656
- data/lib/Dnsruby/Resolver.rb +0 -1189
- data/lib/Dnsruby/TheLog.rb +0 -44
- data/lib/Dnsruby/message.rb +0 -1230
- data/lib/Dnsruby/resource/A.rb +0 -56
- data/lib/Dnsruby/resource/AAAA.rb +0 -54
- data/lib/Dnsruby/resource/DLV.rb +0 -27
- data/lib/Dnsruby/resource/NSEC.rb +0 -298
- data/lib/Dnsruby/resource/NSEC3.rb +0 -340
- data/lib/Dnsruby/resource/NSEC3PARAM.rb +0 -135
- data/lib/Dnsruby/resource/OPT.rb +0 -213
- data/lib/Dnsruby/resource/RRSIG.rb +0 -275
- data/lib/Dnsruby/resource/SPF.rb +0 -29
- data/lib/Dnsruby/resource/SRV.rb +0 -112
- data/lib/Dnsruby/resource/TKEY.rb +0 -163
- data/lib/Dnsruby/resource/TSIG.rb +0 -593
- data/lib/Dnsruby/resource/X25.rb +0 -55
- data/lib/Dnsruby/resource/resource.rb +0 -678
- data/lib/Dnsruby/update.rb +0 -278
- data/lib/Dnsruby/validator_thread.rb +0 -124
|
@@ -1,46 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
#Copyright 2007 Nominet UK
|
|
3
|
-
#
|
|
4
|
-
#Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
#you may not use this file except in compliance with the License.
|
|
6
|
-
#You may obtain a copy of the License at
|
|
7
|
-
#
|
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
#Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
#distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
#See the License for the specific language governing permissions and
|
|
14
|
-
#limitations under the License.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
end
|
|
20
|
-
require 'test/unit'
|
|
21
|
-
require 'dnsruby'
|
|
1
|
+
# --
|
|
2
|
+
# Copyright 2007 Nominet UK
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ++
|
|
16
|
+
|
|
17
|
+
require_relative 'spec_helper'
|
|
18
|
+
|
|
22
19
|
include Dnsruby
|
|
23
|
-
class TestPacketUniquePush < Test
|
|
24
|
-
#
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
#
|
|
20
|
+
class TestPacketUniquePush < Minitest::Test
|
|
21
|
+
# def test_packUniquePush
|
|
22
|
+
#
|
|
23
|
+
#
|
|
24
|
+
# testProc('unique_push');
|
|
25
|
+
# end
|
|
26
|
+
#
|
|
27
|
+
# # def test_packetSafePush
|
|
28
|
+
# # begin
|
|
29
|
+
# # testProc('safe_push');
|
|
30
|
+
# # flunk("Shouldn't work!")
|
|
31
|
+
# # rescue Exception
|
|
32
|
+
# # end
|
|
33
|
+
# # end
|
|
34
|
+
|
|
35
|
+
# def testProc (method)
|
|
39
36
|
def test_proc
|
|
40
37
|
domain = 'example.com';
|
|
41
|
-
|
|
38
|
+
|
|
42
39
|
tests = [
|
|
43
|
-
[
|
|
40
|
+
[
|
|
44
41
|
1,
|
|
45
42
|
RR.create('foo.example.com 60 IN A 10.0.0.1'),
|
|
46
43
|
RR.create('foo.example.com 60 IN A 10.0.0.1'),
|
|
@@ -50,26 +47,26 @@ class TestPacketUniquePush < Test::Unit::TestCase
|
|
|
50
47
|
RR.create('foo.example.com 60 IN A 10.0.0.1'),
|
|
51
48
|
RR.create('bar.example.com 60 IN A 10.0.0.1'),
|
|
52
49
|
],
|
|
53
|
-
[
|
|
50
|
+
[
|
|
54
51
|
1, # RFC 2136 section 1.1
|
|
55
52
|
RR.create('foo.example.com 60 IN A 10.0.0.1'),
|
|
56
53
|
RR.create('foo.example.com 60 IN A 10.0.0.1'),
|
|
57
54
|
RR.create('foo.example.com 90 IN A 10.0.0.1'),
|
|
58
55
|
],
|
|
59
|
-
[
|
|
56
|
+
[
|
|
60
57
|
3,
|
|
61
58
|
RR.create('foo.example.com 60 IN A 10.0.0.1'),
|
|
62
59
|
RR.create('foo.example.com 60 IN A 10.0.0.2'),
|
|
63
60
|
RR.create('foo.example.com 60 IN A 10.0.0.3'),
|
|
64
61
|
],
|
|
65
|
-
[
|
|
62
|
+
[
|
|
66
63
|
3,
|
|
67
64
|
RR.create('foo.example.com 60 IN A 10.0.0.1'),
|
|
68
65
|
RR.create('foo.example.com 60 IN A 10.0.0.2'),
|
|
69
66
|
RR.create('foo.example.com 60 IN A 10.0.0.3'),
|
|
70
67
|
RR.create('foo.example.com 60 IN A 10.0.0.1'),
|
|
71
68
|
],
|
|
72
|
-
[
|
|
69
|
+
[
|
|
73
70
|
3,
|
|
74
71
|
RR.create('foo.example.com 60 IN A 10.0.0.1'),
|
|
75
72
|
RR.create('foo.example.com 60 IN A 10.0.0.2'),
|
|
@@ -77,28 +74,28 @@ class TestPacketUniquePush < Test::Unit::TestCase
|
|
|
77
74
|
RR.create('foo.example.com 60 IN A 10.0.0.4'),
|
|
78
75
|
],
|
|
79
76
|
]
|
|
80
|
-
|
|
77
|
+
|
|
81
78
|
methods = {
|
|
82
79
|
'add_answer' => 'ancount',
|
|
83
80
|
'add_authority' => 'nscount',
|
|
84
81
|
'add_additional' => 'arcount',
|
|
85
82
|
}
|
|
86
|
-
|
|
87
|
-
tests.each do | try |
|
|
83
|
+
|
|
84
|
+
tests.each do | try |
|
|
88
85
|
count = try.shift;
|
|
89
86
|
rrs = try;
|
|
90
|
-
|
|
87
|
+
|
|
91
88
|
methods.each do |method, count_meth|
|
|
92
|
-
|
|
89
|
+
|
|
93
90
|
packet = Message.new(domain)
|
|
94
|
-
|
|
91
|
+
|
|
95
92
|
rrs.each do |rr|
|
|
96
93
|
packet.send(method,rr)
|
|
97
94
|
end
|
|
98
|
-
|
|
95
|
+
|
|
99
96
|
assert_equal(count, packet.header.send(count_meth), "#{method} right for #{rrs.inspect}");
|
|
100
97
|
assert_equal(count, packet.header.send(count_meth), "#{method} right for #{rrs.inspect}");
|
|
101
|
-
|
|
98
|
+
|
|
102
99
|
end
|
|
103
100
|
end
|
|
104
101
|
end
|
data/test/tc_question.rb
CHANGED
|
@@ -1,54 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
#Copyright 2007 Nominet UK
|
|
3
|
-
#
|
|
4
|
-
#Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
#you may not use this file except in compliance with the License.
|
|
6
|
-
#You may obtain a copy of the License at
|
|
7
|
-
#
|
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
#Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
#distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
#See the License for the specific language governing permissions and
|
|
14
|
-
#limitations under the License.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
end
|
|
20
|
-
require 'test/unit'
|
|
21
|
-
require 'dnsruby'
|
|
1
|
+
# --
|
|
2
|
+
# Copyright 2007 Nominet UK
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ++
|
|
16
|
+
|
|
17
|
+
require_relative 'spec_helper'
|
|
18
|
+
|
|
22
19
|
include Dnsruby
|
|
23
|
-
class TestQuestion < Test
|
|
20
|
+
class TestQuestion < Minitest::Test
|
|
24
21
|
def test_question
|
|
25
22
|
domain = "example.com"
|
|
26
23
|
type = Types.MX
|
|
27
24
|
klass = Classes.IN
|
|
28
|
-
|
|
25
|
+
|
|
29
26
|
q = Question.new(domain, type, klass)
|
|
30
27
|
assert(q, "new() returned something")
|
|
31
28
|
assert_equal(domain, q.qname.to_s, "qName()")
|
|
32
29
|
assert_equal(type, q.qtype, "qType()")
|
|
33
30
|
assert_equal(klass, q.qclass, "qClass()")
|
|
34
|
-
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
31
|
+
|
|
32
|
+
#
|
|
33
|
+
# Check the aliases
|
|
34
|
+
#
|
|
38
35
|
assert_equal(q.zname.to_s, domain, 'zName()' );
|
|
39
36
|
assert_equal(q.ztype, type, 'zType()' );
|
|
40
37
|
assert_equal(q.zclass, klass, 'zClass()' );
|
|
41
|
-
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
38
|
+
|
|
39
|
+
#
|
|
40
|
+
# Check that we can change stuff
|
|
41
|
+
#
|
|
45
42
|
q.qname=('example.net');
|
|
46
43
|
q.qtype=('A');
|
|
47
44
|
q.qclass=('CH');
|
|
48
|
-
|
|
45
|
+
|
|
49
46
|
assert_equal('example.net', q.qname.to_s, 'qName()' );
|
|
50
47
|
assert_equal(q.qtype, Types.A, 'qType()' );
|
|
51
48
|
assert_equal(q.qclass, Classes.CH, 'qClass()' );
|
|
52
|
-
|
|
49
|
+
|
|
53
50
|
end
|
|
54
51
|
end
|
data/test/tc_queue.rb
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
#Copyright 2007 Nominet UK
|
|
3
|
-
#
|
|
4
|
-
#Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
#you may not use this file except in compliance with the License.
|
|
6
|
-
#You may obtain a copy of the License at
|
|
7
|
-
#
|
|
1
|
+
# --
|
|
2
|
+
# Copyright 2007 Nominet UK
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
#Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
#distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
#See the License for the specific language governing permissions and
|
|
14
|
-
#limitations under the License.
|
|
15
|
-
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ++
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
require 'dnsruby'
|
|
17
|
+
require_relative 'spec_helper'
|
|
19
18
|
|
|
20
|
-
class TestQueue < Test
|
|
19
|
+
class TestQueue < Minitest::Test
|
|
21
20
|
def test_queue
|
|
22
21
|
q = Queue.new
|
|
23
22
|
r = Dnsruby::Resolver.new
|
data/test/tc_recur.rb
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
#Copyright 2007 Nominet UK
|
|
3
|
-
#
|
|
4
|
-
#Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
#you may not use this file except in compliance with the License.
|
|
6
|
-
#You may obtain a copy of the License at
|
|
7
|
-
#
|
|
1
|
+
# --
|
|
2
|
+
# Copyright 2007 Nominet UK
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
#Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
#distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
#See the License for the specific language governing permissions and
|
|
14
|
-
#limitations under the License.
|
|
15
|
-
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ++
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
require 'test/unit'
|
|
17
|
+
require_relative 'spec_helper'
|
|
19
18
|
|
|
20
|
-
class TestRecur < Test
|
|
19
|
+
class TestRecur < Minitest::Test
|
|
21
20
|
def test_recur
|
|
22
21
|
Dnsruby::PacketSender.clear_caches
|
|
23
22
|
r = Dnsruby::Recursor.new
|
data/test/tc_res_config.rb
CHANGED
|
@@ -1,53 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
#Copyright 2007 Nominet UK
|
|
3
|
-
#
|
|
4
|
-
#Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
#you may not use this file except in compliance with the License.
|
|
6
|
-
#You may obtain a copy of the License at
|
|
7
|
-
#
|
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
#Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
#distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
#See the License for the specific language governing permissions and
|
|
14
|
-
#limitations under the License.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
require 'dnsruby'
|
|
22
|
-
class TestResolverConfig < Test::Unit::TestCase
|
|
23
|
-
|
|
1
|
+
# --
|
|
2
|
+
# Copyright 2007 Nominet UK
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ++
|
|
16
|
+
|
|
17
|
+
require_relative 'spec_helper'
|
|
18
|
+
|
|
19
|
+
class TestResolverConfig < Minitest::Test
|
|
20
|
+
|
|
24
21
|
GoodInput = {
|
|
25
22
|
"port" => 54,
|
|
26
23
|
"src_address" => '10.1.0.1',
|
|
27
24
|
"src_address6" => 'fc00::1:2:3',
|
|
28
25
|
"src_port" => 56453,
|
|
29
26
|
"use_tcp" => true,
|
|
30
|
-
#
|
|
27
|
+
# "stayopen" => 1,
|
|
31
28
|
"ignore_truncation" => true,
|
|
32
29
|
"recurse" => false,
|
|
33
30
|
"packet_timeout" => 5,
|
|
34
|
-
#
|
|
35
|
-
#
|
|
31
|
+
# "dnssec" => 1,
|
|
32
|
+
# "force_v4" => 1,
|
|
36
33
|
};
|
|
37
|
-
|
|
34
|
+
|
|
38
35
|
ExtendedInput={
|
|
39
36
|
"query_timeout" => 30,
|
|
40
37
|
"retry_delay" => 6,
|
|
41
38
|
"retry_times" => 5,
|
|
42
39
|
}
|
|
43
|
-
|
|
40
|
+
|
|
44
41
|
LookupInput={
|
|
45
42
|
"domain" => 'dnsruby.rubyforge.org',
|
|
46
43
|
"apply_search_list" => false,
|
|
47
44
|
"ndots" => 4 ,
|
|
48
45
|
"apply_domain" => false
|
|
49
46
|
}
|
|
50
|
-
|
|
47
|
+
|
|
51
48
|
def setup
|
|
52
49
|
Dnsruby::Config.reset
|
|
53
50
|
end
|
|
@@ -57,35 +54,35 @@ class TestResolverConfig < Test::Unit::TestCase
|
|
|
57
54
|
assert(res, "new returned something");
|
|
58
55
|
assert_instance_of(Dnsruby::Resolver, res, "new() returns an object of the correct class.");
|
|
59
56
|
|
|
60
|
-
#
|
|
61
|
-
|
|
57
|
+
# assert(res.config.nameserver, 'nameserver() works');
|
|
58
|
+
|
|
62
59
|
searchlist = ["t.dnsruby.validation-test-servers.nominet.org.uk", "t2.dnsruby.validation-test-servers.nominet.org.uk"];
|
|
63
60
|
assert_equal(res.config.search=searchlist, searchlist, 'setting searchlist returns correctly.');
|
|
64
61
|
assert_equal(res.config.search, searchlist, 'setting searchlist stickts.');
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# ~ #diag "\n\nIf you do not have Net::DNS::SEC installed you will see a warning.\n";
|
|
65
|
+
# ~ #diag "It is safe to ignore this\n";
|
|
69
66
|
|
|
70
67
|
(GoodInput.merge(ExtendedInput)).each do | param, value |
|
|
71
|
-
#
|
|
68
|
+
# puts("Setting " + param);
|
|
72
69
|
res.send(param+"=", value)
|
|
73
70
|
assert_equal(res.send(param), value, "setting #param sticks");
|
|
74
71
|
end;
|
|
75
|
-
|
|
72
|
+
|
|
76
73
|
end
|
|
77
|
-
|
|
74
|
+
|
|
78
75
|
def test_single_resolver
|
|
79
76
|
[Dnsruby::SingleResolver.new({:nameserver => ["127.0.0.1"]}),
|
|
80
77
|
Dnsruby::SingleResolver.new({:nameserver => ["::1"]})].each {|res|
|
|
81
78
|
GoodInput.each do | param, value |
|
|
82
|
-
#
|
|
79
|
+
# puts("Setting " + param);
|
|
83
80
|
res.send(param+"=", value)
|
|
84
81
|
assert_equal(res.send(param), value, "setting #param sticks");
|
|
85
82
|
end;
|
|
86
83
|
}
|
|
87
84
|
end
|
|
88
|
-
|
|
85
|
+
|
|
89
86
|
def test_dns
|
|
90
87
|
res = Dnsruby::DNS.new
|
|
91
88
|
LookupInput.each do | param, value |
|
|
@@ -93,5 +90,5 @@ class TestResolverConfig < Test::Unit::TestCase
|
|
|
93
90
|
assert_equal(res.config.send(param), value, "setting #param sticks");
|
|
94
91
|
end;
|
|
95
92
|
end
|
|
96
|
-
|
|
93
|
+
|
|
97
94
|
end
|