redns 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/redns/resolver.rb +4 -4
- data/redns.gemspec +2 -2
- data/test/test_redns_resolver.rb +47 -17
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
data/lib/redns/resolver.rb
CHANGED
@@ -210,14 +210,14 @@ class ReDNS::Resolver
|
|
210
210
|
end
|
211
211
|
end
|
212
212
|
|
213
|
-
|
213
|
+
protected
|
214
214
|
def expand_answers(r)
|
215
215
|
unless (r and r.answers)
|
216
216
|
return nil
|
217
217
|
end
|
218
218
|
|
219
219
|
result = r.answers
|
220
|
-
radd = (r.
|
220
|
+
radd = (r.additional_records or [ ])
|
221
221
|
|
222
222
|
result.reject { |rr| rr.rtype == :a }.each do |rr|
|
223
223
|
# Additional resource records may be related to the query, or they
|
@@ -235,7 +235,7 @@ class ReDNS::Resolver
|
|
235
235
|
|
236
236
|
if (additional and !additional.empty?)
|
237
237
|
# Push any results into the record itself
|
238
|
-
|
238
|
+
r.additional_records = additional
|
239
239
|
end
|
240
240
|
end
|
241
241
|
|
@@ -255,7 +255,7 @@ class ReDNS::Resolver
|
|
255
255
|
row
|
256
256
|
end
|
257
257
|
|
258
|
-
r.
|
258
|
+
r.additional_records and r.additional_records.each do |a|
|
259
259
|
row = a.to_a
|
260
260
|
rev[row[0]] = row[4]
|
261
261
|
res.push(row)
|
data/redns.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{redns}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["tadman"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-09-23}
|
13
13
|
s.description = %q{ReDNS is a pure Ruby DNS library with drivers for reactor-model engines such as EventMachine}
|
14
14
|
s.email = %q{github@tadman.ca}
|
15
15
|
s.extra_rdoc_files = [
|
data/test/test_redns_resolver.rb
CHANGED
@@ -17,6 +17,28 @@ class TestReReDNSResolver < Test::Unit::TestCase
|
|
17
17
|
assert_equal [ "192.168.1.1" ], res.servers
|
18
18
|
end
|
19
19
|
|
20
|
+
def test_simple_query
|
21
|
+
res = ReDNS::Resolver.new
|
22
|
+
|
23
|
+
r = res.simple_query(:a, 'example.com')
|
24
|
+
|
25
|
+
assert_equal 1, r.size
|
26
|
+
|
27
|
+
assert_equal :a, r[0].rtype
|
28
|
+
assert_equal '192.0.32.10', r[0].rdata.to_s
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_simple_reverse_query
|
32
|
+
res = ReDNS::Resolver.new
|
33
|
+
|
34
|
+
r = res.simple_query(:ptr, '10.32.0.192.in-addr.arpa')
|
35
|
+
|
36
|
+
assert_equal 1, r.size
|
37
|
+
|
38
|
+
assert_equal :ptr, r[0].rtype
|
39
|
+
assert_equal 'www.example.com.', r[0].rdata.to_s
|
40
|
+
end
|
41
|
+
|
20
42
|
def test_query
|
21
43
|
res = ReDNS::Resolver.new
|
22
44
|
|
@@ -54,10 +76,12 @@ class TestReReDNSResolver < Test::Unit::TestCase
|
|
54
76
|
|
55
77
|
def test_bulk_query
|
56
78
|
addrs = %w[
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
79
|
+
192.0.32.1
|
80
|
+
192.0.32.2
|
81
|
+
192.0.32.3
|
82
|
+
192.0.32.4
|
83
|
+
192.0.32.5
|
84
|
+
192.0.32.10
|
61
85
|
].collect do |i|
|
62
86
|
ReDNS::Support.addr_to_arpa(i)
|
63
87
|
end
|
@@ -68,17 +92,19 @@ class TestReReDNSResolver < Test::Unit::TestCase
|
|
68
92
|
|
69
93
|
assert rlist
|
70
94
|
|
71
|
-
assert_equal
|
95
|
+
assert_equal 6, rlist.length
|
72
96
|
|
73
97
|
assert_equal addrs.sort, rlist.keys.sort
|
74
98
|
|
75
99
|
assert rlist[addrs[0]]
|
76
100
|
|
77
101
|
expected = %w[
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
102
|
+
32-1.lax.icann.org.
|
103
|
+
32-2.lax.icann.org.
|
104
|
+
32-3.lax.icann.org.
|
105
|
+
32-4.lax.icann.org.
|
106
|
+
32-5.lax.icann.org.
|
107
|
+
www.example.com.
|
82
108
|
]
|
83
109
|
|
84
110
|
answers = addrs.collect do |a|
|
@@ -90,10 +116,12 @@ class TestReReDNSResolver < Test::Unit::TestCase
|
|
90
116
|
|
91
117
|
def test_reverse_addresses
|
92
118
|
addrs = %w[
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
119
|
+
192.0.32.1
|
120
|
+
192.0.32.2
|
121
|
+
192.0.32.3
|
122
|
+
192.0.32.4
|
123
|
+
192.0.32.5
|
124
|
+
192.0.32.10
|
97
125
|
]
|
98
126
|
|
99
127
|
res = ReDNS::Resolver.new
|
@@ -105,10 +133,12 @@ class TestReReDNSResolver < Test::Unit::TestCase
|
|
105
133
|
assert_equal addrs.length, rlist.length
|
106
134
|
|
107
135
|
expected = %w[
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
136
|
+
32-1.lax.icann.org.
|
137
|
+
32-2.lax.icann.org.
|
138
|
+
32-3.lax.icann.org.
|
139
|
+
32-4.lax.icann.org.
|
140
|
+
32-5.lax.icann.org.
|
141
|
+
www.example.com.
|
112
142
|
]
|
113
143
|
|
114
144
|
answers = addrs.collect do |a|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 7
|
9
|
+
version: 0.1.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- tadman
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-09-23 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|