celluloid-dns 0.0.1 → 0.17.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +0 -2
  3. data/.simplecov +15 -0
  4. data/.travis.yml +13 -7
  5. data/Gemfile +5 -6
  6. data/README.md +118 -41
  7. data/Rakefile +8 -3
  8. data/celluloid-dns.gemspec +29 -18
  9. data/lib/celluloid/dns.rb +30 -7
  10. data/lib/celluloid/dns/chunked.rb +34 -0
  11. data/lib/celluloid/dns/extensions/resolv.rb +136 -0
  12. data/lib/celluloid/dns/extensions/string.rb +28 -0
  13. data/lib/celluloid/dns/handler.rb +198 -0
  14. data/lib/celluloid/dns/logger.rb +31 -0
  15. data/lib/celluloid/dns/message.rb +76 -0
  16. data/lib/celluloid/dns/replace.rb +54 -0
  17. data/lib/celluloid/dns/resolver.rb +288 -0
  18. data/lib/celluloid/dns/server.rb +151 -27
  19. data/lib/celluloid/dns/system.rb +146 -0
  20. data/lib/celluloid/dns/transaction.rb +202 -0
  21. data/lib/celluloid/dns/transport.rb +75 -0
  22. data/lib/celluloid/dns/version.rb +23 -3
  23. data/spec/celluloid/dns/celluloid_bug_spec.rb +92 -0
  24. data/spec/celluloid/dns/hosts.txt +2 -0
  25. data/spec/celluloid/dns/ipv6_spec.rb +70 -0
  26. data/spec/celluloid/dns/message_spec.rb +56 -0
  27. data/spec/celluloid/dns/origin_spec.rb +106 -0
  28. data/spec/celluloid/dns/replace_spec.rb +42 -0
  29. data/spec/celluloid/dns/resolver_performance_spec.rb +110 -0
  30. data/spec/celluloid/dns/resolver_spec.rb +152 -0
  31. data/spec/celluloid/dns/server/bind9/generate-local.rb +25 -0
  32. data/spec/celluloid/dns/server/bind9/local.zone +5014 -0
  33. data/spec/celluloid/dns/server/bind9/named.conf +14 -0
  34. data/spec/celluloid/dns/server/bind9/named.run +0 -0
  35. data/spec/celluloid/dns/server/million.rb +85 -0
  36. data/spec/celluloid/dns/server_performance_spec.rb +139 -0
  37. data/spec/celluloid/dns/slow_server_spec.rb +91 -0
  38. data/spec/celluloid/dns/socket_spec.rb +71 -0
  39. data/spec/celluloid/dns/system_spec.rb +60 -0
  40. data/spec/celluloid/dns/transaction_spec.rb +138 -0
  41. data/spec/celluloid/dns/truncation_spec.rb +62 -0
  42. metadata +124 -56
  43. data/.coveralls.yml +0 -1
  44. data/.gitignore +0 -17
  45. data/CHANGES.md +0 -3
  46. data/LICENSE.txt +0 -22
  47. data/lib/celluloid/dns/request.rb +0 -46
  48. data/spec/celluloid/dns/server_spec.rb +0 -26
  49. data/spec/spec_helper.rb +0 -5
  50. data/tasks/rspec.task +0 -7
@@ -1 +0,0 @@
1
- service-name: travis-pro
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/CHANGES.md DELETED
@@ -1,3 +0,0 @@
1
- 0.0.1 (2013-03-18)
2
- ------------------
3
- * Initial release
@@ -1,22 +0,0 @@
1
- Copyright (c) 2012 Tony Arcieri
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,46 +0,0 @@
1
- require 'resolv'
2
-
3
- module Celluloid
4
- module DNS
5
- class Request
6
- attr_reader :questions
7
-
8
- def initialize(addr, port, socket, data)
9
- @addr, @port, @socket = addr, port, socket
10
- @message = Resolv::DNS::Message.decode(data)
11
- @questions = @message.question.map { |question, resource| Question.new(question, resource) }
12
- end
13
-
14
- def answer(responses)
15
- response_message = Resolv::DNS::Message.new @message.id
16
- response_message.qr = 1
17
- response_message.opcode = @message.opcode
18
- response_message.aa = 1
19
- response_message.rd = @message.rd
20
- response_message.ra = 0
21
- response_message.rcode = 0
22
-
23
- responses.each do |question, response|
24
- response_object = question.resource.new(response)
25
- response_message.add_answer question.name, DEFAULT_TTL, response_object
26
- end
27
-
28
- @socket.send response_message.encode, 0, @addr, @port
29
- end
30
- end
31
-
32
- class Question
33
- attr_reader :resource
34
-
35
- def initialize(question, resource)
36
- @question, @resource = question, resource
37
- end
38
-
39
- # Obtain the name being queried
40
- def name
41
- raise TypeError, "not a name query" unless @question.is_a? Resolv::DNS::Name
42
- @question.to_s
43
- end
44
- end
45
- end
46
- end
@@ -1,26 +0,0 @@
1
- require 'spec_helper'
2
- require 'resolv'
3
-
4
- describe Celluloid::DNS::Server do
5
- let(:example_host) { '127.0.0.1' }
6
- let(:example_port) { 54321 }
7
- let(:example_name) { 'example.com' }
8
- let(:example_ip) { '1.2.3.4' }
9
-
10
- it "answers DNS requests" do
11
- server = Celluloid::DNS::Server.new(example_host, example_port) do |request|
12
- question = request.questions.first
13
-
14
- question.name.should == example_name
15
- request.answer(question => example_ip)
16
- end
17
-
18
- begin
19
- Resolv::DNS.open(nameserver_port: [[example_host, example_port]]) do |resolv|
20
- resolv.getaddress(example_name).to_s.should eq example_ip
21
- end
22
- ensure
23
- server.terminate
24
- end
25
- end
26
- end
@@ -1,5 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
- require 'celluloid/dns'
4
- require 'coveralls'
5
- Coveralls.wear!
@@ -1,7 +0,0 @@
1
- require 'rspec/core/rake_task'
2
-
3
- RSpec::Core::RakeTask.new
4
-
5
- RSpec::Core::RakeTask.new(:rcov) do |task|
6
- task.rcov = true
7
- end