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 CHANGED
@@ -1 +1 @@
1
- 0.1.6
1
+ 0.1.7
@@ -210,14 +210,14 @@ class ReDNS::Resolver
210
210
  end
211
211
  end
212
212
 
213
- protected
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.additional or [ ])
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
- rr.additional = additional
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.additional and r.additional.each do |a|
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.6"
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-08-18}
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 = [
@@ -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
- 128.100.8.1
58
- 128.100.8.2
59
- 128.100.8.3
60
- 128.100.8.4
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 4, rlist.length
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
- sf-ecf.gw.utoronto.ca.
79
- fs.ecf.utoronto.ca.
80
- ecf-if.gw.utoronto.ca.
81
- ecf-8-hub.ecf.utoronto.ca.
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
- 128.100.8.1
94
- 128.100.8.2
95
- 128.100.8.3
96
- 128.100.8.4
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
- sf-ecf.gw.utoronto.ca.
109
- fs.ecf.utoronto.ca.
110
- ecf-if.gw.utoronto.ca.
111
- ecf-8-hub.ecf.utoronto.ca.
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
- - 6
9
- version: 0.1.6
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-08-18 00:00:00 -04:00
17
+ date: 2010-09-23 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies: []
20
20