rubydns 0.7.0 → 0.7.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 190faf76114f4bfe4bcbff8896f6d54ff4d75667
4
- data.tar.gz: 76d443584858fdfb9d8223215c47b3935d22f53c
3
+ metadata.gz: ccdcf756b8a2f0e55cd79870c6d02e2780555989
4
+ data.tar.gz: 2f71470c5156ec98b3072d5fedfd59a38f7ca548
5
5
  SHA512:
6
- metadata.gz: 2d850649e8bb3f66638a30519898ece93a710c08925e83a8ca6ef15fce6474f80795133d71dfac0f67756f8945596771ddc6c0e98d6fd554a40e081b6ba41e61
7
- data.tar.gz: e797f439ff7aaa0de6b2cbe15621ebf514a24a39441b200ccc09a15cc8baabc6fbfdf5ab95e69c40f31ef2925addce7f436bf5ea8598861bbbb7e072e922f2a5
6
+ metadata.gz: c53c978b9e44687be068ddad06922f6f84ef243b951077b38fbbba5e3b119d6b6e2ebbd9b6e6049dcf942662fd3531b875438f651d92e0e72252af1aa964c9a4
7
+ data.tar.gz: 7314c0a9b60a96262f2c0dee723c193a79f61676ae6404acc852d74d7462eb6f28b08e76428a11c61c11409877252dfdf543615edb38896738fad6237ddc05d2
data/README.md CHANGED
@@ -63,6 +63,22 @@ Start the server using `rvmsudo ./test.rb`. You can then test it using dig:
63
63
  $ dig @localhost dev.mydomain.org
64
64
  $ dig @localhost google.com
65
65
 
66
+ ### Custom servers
67
+
68
+ It is possible to create and integrate your own custom servers.
69
+
70
+ class MyServer < RubyDNS::Server
71
+ def process(name, resource_class, transaction)
72
+ transaction.fail!(:NXDomain)
73
+ end
74
+ end
75
+
76
+ EventMachine.run do
77
+ MyServer.new.run
78
+ end
79
+
80
+ This is the best way to integrate with other projects.
81
+
66
82
  ## Compatibility
67
83
 
68
84
  ### Migrating from RubyDNS 0.6.x to 0.7.x
@@ -123,7 +123,7 @@ module RubyDNS
123
123
  finish_request!
124
124
 
125
125
  if Exception === response
126
- @logger.warn "[#{@message.id}] Failure while processing response #{exception}!" if @logger
126
+ @logger.warn "[#{@message.id}] Failure while processing response #{response}!" if @logger
127
127
  RubyDNS.log_exception(@logger, response) if @logger
128
128
 
129
129
  try_next_server!
@@ -293,38 +293,5 @@ module RubyDNS
293
293
 
294
294
  Fiber.yield
295
295
  end
296
-
297
- # Process an incoming DNS message. Returns a serialized message to be sent back to the client.
298
- def process_query(query, options = {}, &block)
299
- # Setup answer
300
- answer = Resolv::DNS::Message::new(query.id)
301
- answer.qr = 1 # 0 = Query, 1 = Response
302
- answer.opcode = query.opcode # Type of Query; copy from query
303
- answer.aa = 1 # Is this an authoritative response: 0 = No, 1 = Yes
304
- answer.rd = query.rd # Is Recursion Desired, copied from query
305
- answer.ra = 0 # Does name server support recursion: 0 = No, 1 = Yes
306
- answer.rcode = 0 # Response code: 0 = No errors
307
-
308
- Fiber.new do
309
- transaction = nil
310
-
311
- begin
312
- query.question.each do |question, resource_class|
313
- @logger.debug "Processing question #{question} #{resource_class}..."
314
-
315
- transaction = Transaction.new(self, query, question, resource_class, answer, options)
316
-
317
- transaction.process
318
- end
319
- rescue
320
- @logger.error "Exception thrown while processing #{transaction}!"
321
- RubyDNS.log_exception(@logger, $!)
322
-
323
- answer.rcode = Resolv::DNS::RCode::ServFail
324
- end
325
-
326
- yield answer
327
- end.resume
328
- end
329
296
  end
330
297
  end
@@ -89,7 +89,11 @@ module RubyDNS
89
89
  if block_given?
90
90
  yield response
91
91
  end
92
-
92
+
93
+ # Recursion is available and is being used:
94
+ # See issue #26 for more details.
95
+ @answer.ra = 1
96
+
93
97
  @answer.merge!(response)
94
98
  end
95
99
  else
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module RubyDNS
22
- VERSION = "0.7.0"
22
+ VERSION = "0.7.3"
23
23
  end
@@ -69,7 +69,7 @@ class PassthroughTest < Test::Unit::TestCase
69
69
  end
70
70
 
71
71
  def test_basic_dns
72
- answer = nil
72
+ answer = nil, response = nil
73
73
 
74
74
  assert_equal :running, RExec::Daemon::ProcessFile.status(TestPassthroughServer)
75
75
 
@@ -77,14 +77,18 @@ class PassthroughTest < Test::Unit::TestCase
77
77
  resolver = RubyDNS::Resolver.new(TestPassthroughServer::SERVER_PORTS)
78
78
 
79
79
  resolver.query("google.com") do |response|
80
+ assert_equal 1, response.ra
81
+
80
82
  answer = response.answer.first
81
83
 
82
84
  EventMachine.stop
83
85
  end
84
86
  end
85
87
 
86
- assert answer != nil
88
+ # Check whether we got some useful records in the answer:
89
+ assert_not_nil answer
87
90
  assert answer.count > 0
91
+ assert answer.any? {|record| record.kind_of? Resolv::DNS::Resource::IN::A }
88
92
  end
89
93
 
90
94
  def test_basic_dns_prefix
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubydns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-19 00:00:00.000000000 Z
11
+ date: 2014-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rexec
@@ -136,4 +136,3 @@ test_files:
136
136
  - test/test_slow_server.rb
137
137
  - test/test_system.rb
138
138
  - test/test_truncation.rb
139
- has_rdoc: yard