rubydns 0.5.4 → 0.6.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 ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NWFmMGQwYzlmMGFkMjczY2VlNzExMjdmMDI3NDZiNTFjMTc2Nzk4NQ==
5
+ data.tar.gz: !binary |-
6
+ MjljNzMxODYwNmZlNTdmNzBjMjFkNjRmYjYxZDIxZWRlZmIzYTQ0OA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MWZiMTBlY2YxYjdiYzIzMDU0OTBhMzBkN2RiZjY4OWZlNGFjNzM2ZGUxZTUx
10
+ NDE0MzdiMjFiZTg5OTM2NmVhNjcwMmY0NjE1MzNlN2JmZWM4MTIxMjQwYjk2
11
+ MjVjOTViMDNkYzQ0NTBlZTdlODIzM2IyZDg3NjEwZjNhMDBlNTM=
12
+ data.tar.gz: !binary |-
13
+ NzJiNGE4YjhjY2Q4MjQ3MWU0ODgwOTk4NWJlM2YwYmQ4OWZlNDdkYTIxOTU2
14
+ Y2FjN2UwZjZhNGYzMzc5NDY2NDYyNDFmMmVkMDZkYjg4Zjk2MWQyZjA3YzEw
15
+ NTRlYzZjM2JkYTFjNzUyZDYyNGMwODUxZDdiNjc5NTllZjhmODM=
data/README.md CHANGED
@@ -44,7 +44,7 @@ UPSTREAM = RubyDNS::Resolver.new([[:udp, "8.8.8.8", 53], [:tcp, "8.8.8.8", 53]])
44
44
  def self.run
45
45
  # Start the RubyDNS server
46
46
  RubyDNS::run_server(:listen => INTERFACES) do
47
- match(/test.mydomain.org/, IN::A) do |_host, transaction|
47
+ match(/test.mydomain.org/, IN::A) do |transaction|
48
48
  transaction.respond!("10.0.0.80")
49
49
  end
50
50
 
@@ -65,6 +65,10 @@ $ dig @localhost google.com
65
65
 
66
66
  ## Compatibility
67
67
 
68
+ ### Migrating from RubyDNS 0.5.x to 0.6.x ###
69
+
70
+ The order of arguments to pattern based rules has changed. For regular expression based rules, the arguments are now ordered `|transaction, match_data|`. The main reason for this change was that in many cases match_data is not important and can thus be ignored, e.g. `|transaction|`.
71
+
68
72
  ### Migrating from RubyDNS 0.3.x to 0.4.x ###
69
73
 
70
74
  Due to changes in `resolv.rb`, superficial parts of RubyDNS have changed. Rather than using `:A` to specify A-records, one must now use the class name.
@@ -119,7 +123,7 @@ transaction.defer!
119
123
  Once you call this, the transaction won't complete until you call either `transaction.succeed` or `transaction.fail`.
120
124
  ```ruby
121
125
  RubyDNS::run_server(:listen => SERVER_PORTS) do
122
- match(/\.*.com/, IN::A) do |match, transaction|
126
+ match(/\.*.com/, IN::A) do |transaction|
123
127
  transaction.defer!
124
128
 
125
129
  # No domain exists, after 5 seconds:
@@ -58,7 +58,7 @@ module RubyDNS
58
58
  match_data = @pattern[0].match(name)
59
59
  if match_data
60
60
  server.logger.debug "Regexp pattern matched with #{match_data.inspect}."
61
- return @callback[match_data, *args]
61
+ return @callback[*args, match_data]
62
62
  end
63
63
  when String
64
64
  if @pattern[0] == name
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module RubyDNS
22
- VERSION = "0.5.4"
22
+ VERSION = "0.6.0"
23
23
  end
@@ -47,7 +47,7 @@ class DroppingDaemon < RExec::Daemon::Base
47
47
  def self.run
48
48
  RubyDNS::run_server(:listen => INTERFACES) do
49
49
  # Fail the resolution of certain domains ;)
50
- match(/(m?i?c?r?o?s?o?f?t)/) do |match_data, transaction|
50
+ match(/(m?i?c?r?o?s?o?f?t)/) do |transaction, match_data|
51
51
  if match_data[1].size > 7
52
52
  logger.info "Dropping domain MICROSOFT..."
53
53
  transaction.failure!(:NXDomain)
@@ -58,7 +58,7 @@ class DroppingDaemon < RExec::Daemon::Base
58
58
  end
59
59
 
60
60
  # Hmm....
61
- match(/^(.+\.)?sco\./) do |match_data, transaction|
61
+ match(/^(.+\.)?sco\./) do |transaction|
62
62
  logger.info "Dropping domain SCO..."
63
63
  transaction.failure!(:NXDomain)
64
64
  end
@@ -67,12 +67,12 @@ class FortuneDNS < RExec::Daemon::Base
67
67
  end
68
68
  end
69
69
 
70
- match(/stats\.fortune/, IN::TXT) do |match, transaction|
70
+ match(/stats\.fortune/, IN::TXT) do |transaction|
71
71
  $stderr.puts "Sending stats: #{stats.inspect}"
72
72
  transaction.respond!(stats.inspect)
73
73
  end
74
74
 
75
- match(/(.+)\.fortune/, IN::TXT) do |match, transaction|
75
+ match(/(.+)\.fortune/, IN::TXT) do |transaction|
76
76
  fortune = cache[match[1]]
77
77
  stats[:requested] += 1
78
78
 
@@ -83,7 +83,7 @@ class FortuneDNS < RExec::Daemon::Base
83
83
  end
84
84
  end
85
85
 
86
- match(/fortune/, [IN::CNAME, IN::TXT]) do |match, transaction|
86
+ match(/fortune/, [IN::CNAME, IN::TXT]) do |transaction|
87
87
  fortune = `fortune`.gsub(/\s+/, " ").strip
88
88
  checksum = Digest::MD5.hexdigest(fortune)
89
89
  cache[checksum] = fortune
@@ -52,7 +52,7 @@ class GeoIPDNSDaemon < RExec::Daemon::Base
52
52
 
53
53
  def self.run
54
54
  RubyDNS::run_server(:listen => INTERFACES) do
55
- match(//, IN::A) do |match_data, transaction|
55
+ match(//, IN::A) do |transaction|
56
56
  location = nil
57
57
  peer = transaction.options[:peer]
58
58
 
@@ -57,7 +57,7 @@ RubyDNS::run_server(:listen => [[:udp, "0.0.0.0", 5400]]) do
57
57
 
58
58
  # For this exact address record, return an IP address
59
59
  # dig @localhost -p 5300 CNAME bob.mydomain.org
60
- match(/([^.]+).mydomain.org/, IN::CNAME) do |match_data, transaction|
60
+ match(/([^.]+).mydomain.org/, IN::CNAME) do |transaction|
61
61
  transaction.respond!(Name.create("www.mydomain.org"))
62
62
  transaction.append_query!("www.mydomain.org", IN::A)
63
63
  end
@@ -35,7 +35,7 @@ RubyDNS::run_server do
35
35
  # % dig +nocmd +noall +answer @localhost ANY dev.mydomain.org
36
36
  # dev.mydomain.org. 16000 IN A 10.0.0.80
37
37
  # dev.mydomain.org. 16000 IN MX 10 mail.mydomain.org.
38
- match(/dev.mydomain.org/, IN::ANY) do |match_data, transaction|
38
+ match(/dev.mydomain.org/, IN::ANY) do |transaction|
39
39
  transaction.append_question!
40
40
 
41
41
  [IN::A, IN::CNAME, IN::MX].each do |resource_class|
@@ -57,7 +57,7 @@ RubyDNS::run_server do
57
57
  transaction.respond!(10, Name.create("mail.mydomain.org."))
58
58
  end
59
59
 
60
- match(/^test([0-9]+).mydomain.org$/, IN::A) do |match_data, transaction|
60
+ match(/^test([0-9]+).mydomain.org$/, IN::A) do |transaction, match_data|
61
61
  offset = match_data[1].to_i
62
62
 
63
63
  if offset > 0 && offset < 10
data/test/test_daemon.rb CHANGED
@@ -41,7 +41,7 @@ class BasicTestServer < RExec::Daemon::Base
41
41
  transaction.respond!("192.168.1.1")
42
42
  end
43
43
 
44
- match(/foo.*/, IN::A) do |match, transaction|
44
+ match(/foo.*/, IN::A) do |transaction|
45
45
  transaction.respond!("192.168.1.2")
46
46
  end
47
47
 
@@ -39,7 +39,7 @@ class TestPassthroughServer < RExec::Daemon::Base
39
39
 
40
40
  # Start the RubyDNS server
41
41
  RubyDNS::run_server(:listen => SERVER_PORTS) do
42
- match(/.*\.com/, IN::A) do |match, transaction|
42
+ match(/.*\.com/, IN::A) do |transaction|
43
43
  transaction.passthrough!(resolver)
44
44
  end
45
45
 
@@ -37,7 +37,7 @@ class SlowServer < RExec::Daemon::Base
37
37
 
38
38
  def self.run
39
39
  RubyDNS::run_server(:listen => SERVER_PORTS) do
40
- match(/\.*.com/, IN::A) do |match, transaction|
40
+ match(/\.*.com/, IN::A) do |transaction|
41
41
  transaction.defer!
42
42
 
43
43
  # No domain exists, after 5 seconds:
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubydns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
5
- prerelease:
4
+ version: 0.6.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Samuel Williams
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-19 00:00:00.000000000 Z
11
+ date: 2013-03-14 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rexec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: eventmachine
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -100,33 +95,26 @@ files:
100
95
  - test/test_truncation.rb
101
96
  homepage: https://github.com/ioquatix/rubydns
102
97
  licenses: []
98
+ metadata: {}
103
99
  post_install_message:
104
100
  rdoc_options: []
105
101
  require_paths:
106
102
  - lib
107
103
  required_ruby_version: !ruby/object:Gem::Requirement
108
- none: false
109
104
  requirements:
110
105
  - - ! '>='
111
106
  - !ruby/object:Gem::Version
112
107
  version: '0'
113
- segments:
114
- - 0
115
- hash: 4471214807073304118
116
108
  required_rubygems_version: !ruby/object:Gem::Requirement
117
- none: false
118
109
  requirements:
119
110
  - - ! '>='
120
111
  - !ruby/object:Gem::Version
121
112
  version: '0'
122
- segments:
123
- - 0
124
- hash: 4471214807073304118
125
113
  requirements: []
126
114
  rubyforge_project:
127
- rubygems_version: 1.8.24
115
+ rubygems_version: 2.0.2
128
116
  signing_key:
129
- specification_version: 3
117
+ specification_version: 4
130
118
  summary: An easy to use DNS server and resolver for Ruby.
131
119
  test_files:
132
120
  - test/examples/dropping-dns.rb