net-dns 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/.gitignore +6 -0
  2. data/AUTHORS.rdoc +7 -0
  3. data/CHANGELOG.rdoc +34 -0
  4. data/README.rdoc +26 -14
  5. data/Rakefile +23 -30
  6. data/{THANKS → THANKS.rdoc} +0 -0
  7. data/VERSION.yml +3 -2
  8. data/demo/check_soa.rb +6 -11
  9. data/lib/net/{dns/dns.rb → dns.rb} +5 -12
  10. data/lib/net/dns/core_ext.rb +52 -0
  11. data/lib/net/dns/header.rb +55 -49
  12. data/lib/net/dns/names/names.rb +20 -10
  13. data/lib/net/dns/packet.rb +33 -26
  14. data/lib/net/dns/question.rb +60 -27
  15. data/lib/net/dns/resolver.rb +101 -156
  16. data/lib/net/dns/resolver/timeouts.rb +71 -65
  17. data/lib/net/dns/rr.rb +131 -166
  18. data/lib/net/dns/rr/a.rb +20 -26
  19. data/lib/net/dns/rr/aaaa.rb +15 -20
  20. data/lib/net/dns/rr/classes.rb +1 -1
  21. data/lib/net/dns/rr/cname.rb +8 -14
  22. data/lib/net/dns/rr/hinfo.rb +8 -14
  23. data/lib/net/dns/rr/mr.rb +8 -14
  24. data/lib/net/dns/rr/mx.rb +11 -18
  25. data/lib/net/dns/rr/ns.rb +8 -14
  26. data/lib/net/dns/rr/null.rb +7 -14
  27. data/lib/net/dns/rr/ptr.rb +9 -15
  28. data/lib/net/dns/rr/soa.rb +9 -15
  29. data/lib/net/dns/rr/srv.rb +10 -19
  30. data/lib/net/dns/rr/txt.rb +9 -20
  31. data/lib/net/dns/rr/types.rb +51 -58
  32. data/lib/net/dns/version.rb +22 -0
  33. data/test/{net/dns/test_header.rb → header_test.rb} +20 -20
  34. data/test/{net/dns/test_packet.rb → packet_test.rb} +2 -2
  35. data/test/question_test.rb +84 -0
  36. data/test/resolver/timeouts_test.rb +109 -0
  37. data/test/{net/dns/test_resolver.rb → resolver_test.rb} +6 -6
  38. data/test/rr/a_test.rb +66 -0
  39. data/test/{net/dns/rr/test_classes.rb → rr/classes_test.rb} +5 -5
  40. data/test/rr/ns_test.rb +64 -0
  41. data/test/rr/types_test.rb +69 -0
  42. data/test/{net/dns/test_rr.rb → rr_test.rb} +10 -12
  43. data/test/test_helper.rb +4 -0
  44. metadata +50 -35
  45. data/AUTHORS +0 -10
  46. data/CHANGELOG +0 -7
  47. data/INSTALL +0 -8
  48. data/net-dns.gemspec +0 -92
  49. data/test/net/dns/resolver/test_timeouts.rb +0 -59
  50. data/test/net/dns/rr/test_a.rb +0 -72
  51. data/test/net/dns/rr/test_ns.rb +0 -66
  52. data/test/net/dns/rr/test_types.rb +0 -124
  53. data/test/net/dns/test_question.rb +0 -54
@@ -1,20 +1,20 @@
1
- require 'test/unit'
1
+ require 'test_helper'
2
2
  require 'net/dns/rr'
3
3
 
4
- class Test_RR < Test::Unit::TestCase
4
+ class RRTest < Test::Unit::TestCase
5
5
 
6
6
  def setup
7
- @name = "example.com."
7
+ @rr_name = "example.com."
8
8
  @type = "A"
9
9
  @cls = "IN"
10
10
  @ttl = 10800
11
11
  @rdata = "64.233.187.99"
12
12
 
13
- @defaults = Net::DNS::RR.new(:name => @name,
13
+ @defaults = Net::DNS::RR.new(:name => @rr_name,
14
14
  :rdata => @rdata)
15
15
 
16
16
 
17
- @a_hash = Net::DNS::RR.new(:name => @name,
17
+ @a_hash = Net::DNS::RR.new(:name => @rr_name,
18
18
  :ttl => @ttl,
19
19
  :cls => @cls,
20
20
  :type => @type,
@@ -34,8 +34,7 @@ class Test_RR < Test::Unit::TestCase
34
34
  @mx_data = @mx.data
35
35
  @mx_binary = Net::DNS::RR.parse(@mx_data)
36
36
 
37
- @array = [@name,@ttl,@cls,@type,@rdata]
38
-
37
+ @array = [@rr_name,@ttl,@cls,@type,@rdata]
39
38
  end
40
39
 
41
40
  def test_classes
@@ -95,22 +94,21 @@ class Test_RR < Test::Unit::TestCase
95
94
  end
96
95
 
97
96
  def test_simple
98
-
99
- assert_equal @name, @defaults.name
97
+ assert_equal @rr_name, @defaults.name
100
98
  assert_equal @type, @defaults.type
101
99
  assert_equal @cls, @defaults.cls
102
100
  assert_equal @ttl, @defaults.ttl
103
101
  assert_equal @rdata, @defaults.rdata.to_s
104
102
 
105
103
  assert_equal(@str,@a_hash.inspect)
106
- assert_equal(@name, @a_hash.name)
104
+ assert_equal(@rr_name, @a_hash.name)
107
105
  assert_equal(@type, @a_hash.type)
108
106
  assert_equal(@cls, @a_hash.cls)
109
107
  assert_equal(@ttl, @a_hash.ttl)
110
108
  assert_equal(@rdata, @a_hash.address.to_s)
111
109
 
112
110
  assert_equal(@str, @a_string.inspect)
113
- assert_equal(@name, @a_string.name)
111
+ assert_equal(@rr_name, @a_string.name)
114
112
  assert_equal(@type, @a_string.type)
115
113
  assert_equal(@cls, @a_string.cls)
116
114
  assert_equal(@ttl, @a_string.ttl)
@@ -124,7 +122,7 @@ class Test_RR < Test::Unit::TestCase
124
122
  end
125
123
 
126
124
  def test_range
127
- assert_raise(RRArgumentError) do
125
+ assert_raise(Net::DNS::RR::ArgumentError) do
128
126
  Net::DNS::RR.new("google.com. 10800 IM A")
129
127
  end
130
128
  end
@@ -0,0 +1,4 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
2
+
3
+ require 'test/unit'
4
+ require 'net/dns'
metadata CHANGED
@@ -1,40 +1,53 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-dns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Ceresa
8
+ - Simone Carletti
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
 
12
- date: 2009-06-16 00:00:00 +01:00
13
+ date: 2009-11-07 00:00:00 +01:00
13
14
  default_executable:
14
- dependencies: []
15
-
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rcov
18
+ type: :development
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ version:
16
26
  description: Net::DNS is a pure Ruby DNS library, with a clean OO interface and an extensible API
17
- email: ceresa@gmail.com
27
+ email:
28
+ - ceresa@gmail.com
29
+ - weppos@weppos.net
18
30
  executables: []
19
31
 
20
32
  extensions: []
21
33
 
22
34
  extra_rdoc_files:
23
- - AUTHORS
24
- - INSTALL
35
+ - AUTHORS.rdoc
36
+ - CHANGELOG.rdoc
25
37
  - README.rdoc
26
- - THANKS
38
+ - THANKS.rdoc
27
39
  files:
28
- - AUTHORS
29
- - CHANGELOG
30
- - INSTALL
40
+ - .gitignore
41
+ - AUTHORS.rdoc
42
+ - CHANGELOG.rdoc
31
43
  - README.rdoc
32
44
  - Rakefile
33
- - THANKS
45
+ - THANKS.rdoc
34
46
  - VERSION.yml
35
47
  - demo/check_soa.rb
36
48
  - demo/threads.rb
37
- - lib/net/dns/dns.rb
49
+ - lib/net/dns.rb
50
+ - lib/net/dns/core_ext.rb
38
51
  - lib/net/dns/header.rb
39
52
  - lib/net/dns/names/names.rb
40
53
  - lib/net/dns/packet.rb
@@ -57,18 +70,19 @@ files:
57
70
  - lib/net/dns/rr/srv.rb
58
71
  - lib/net/dns/rr/txt.rb
59
72
  - lib/net/dns/rr/types.rb
60
- - net-dns.gemspec
73
+ - lib/net/dns/version.rb
61
74
  - setup.rb
62
- - test/net/dns/resolver/test_timeouts.rb
63
- - test/net/dns/rr/test_a.rb
64
- - test/net/dns/rr/test_classes.rb
65
- - test/net/dns/rr/test_ns.rb
66
- - test/net/dns/rr/test_types.rb
67
- - test/net/dns/test_header.rb
68
- - test/net/dns/test_packet.rb
69
- - test/net/dns/test_question.rb
70
- - test/net/dns/test_resolver.rb
71
- - test/net/dns/test_rr.rb
75
+ - test/header_test.rb
76
+ - test/packet_test.rb
77
+ - test/question_test.rb
78
+ - test/resolver/timeouts_test.rb
79
+ - test/resolver_test.rb
80
+ - test/rr/a_test.rb
81
+ - test/rr/classes_test.rb
82
+ - test/rr/ns_test.rb
83
+ - test/rr/types_test.rb
84
+ - test/rr_test.rb
85
+ - test/test_helper.rb
72
86
  has_rdoc: true
73
87
  homepage: http://github.com/bluemonk/net-dns
74
88
  licenses: []
@@ -93,18 +107,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
107
  requirements: []
94
108
 
95
109
  rubyforge_project: net-dns
96
- rubygems_version: 1.3.3
110
+ rubygems_version: 1.3.5
97
111
  signing_key:
98
112
  specification_version: 3
99
113
  summary: Pure Ruby DNS library
100
114
  test_files:
101
- - test/net/dns/test_header.rb
102
- - test/net/dns/rr/test_types.rb
103
- - test/net/dns/rr/test_a.rb
104
- - test/net/dns/rr/test_ns.rb
105
- - test/net/dns/rr/test_classes.rb
106
- - test/net/dns/resolver/test_timeouts.rb
107
- - test/net/dns/test_rr.rb
108
- - test/net/dns/test_packet.rb
109
- - test/net/dns/test_question.rb
110
- - test/net/dns/test_resolver.rb
115
+ - test/header_test.rb
116
+ - test/packet_test.rb
117
+ - test/question_test.rb
118
+ - test/resolver/timeouts_test.rb
119
+ - test/resolver_test.rb
120
+ - test/rr/a_test.rb
121
+ - test/rr/classes_test.rb
122
+ - test/rr/ns_test.rb
123
+ - test/rr/types_test.rb
124
+ - test/rr_test.rb
125
+ - test/test_helper.rb
data/AUTHORS DELETED
@@ -1,10 +0,0 @@
1
- # $Id: AUTHORS,v 1.2 2005/06/17 10:09:57 bluemonk Exp $
2
-
3
-
4
- AUTHORS
5
-
6
- Net::DNS core development:
7
- Marco Ceresa <ceresa@ieee.org>
8
-
9
- Beta testing:
10
-
data/CHANGELOG DELETED
@@ -1,7 +0,0 @@
1
- net-dns 0.4
2
- - many bug fixes (thanks guys!)
3
- - a whole new class Net::DNS::Header::RCode
4
- - new methods in Net::DNS::Resolver class to
5
- do AXFR queries
6
- - a new SRV resource record written by Dan Janowski
7
- - more documentation written and corrected
data/INSTALL DELETED
@@ -1,8 +0,0 @@
1
- If you didn't install this from gem, you can do a
2
-
3
- # ruby setup.rb
4
-
5
- or, from normal user (with sudo)
6
-
7
- $ rake install
8
-
@@ -1,92 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- Gem::Specification.new do |s|
4
- s.name = %q{net-dns}
5
- s.version = "0.5.3"
6
-
7
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Marco Ceresa"]
9
- s.date = %q{2009-06-16}
10
- s.description = %q{Net::DNS is a pure Ruby DNS library, with a clean OO interface and an extensible API}
11
- s.email = %q{ceresa@gmail.com}
12
- s.extra_rdoc_files = [
13
- "AUTHORS",
14
- "INSTALL",
15
- "README.rdoc",
16
- "THANKS"
17
- ]
18
- s.files = [
19
- "AUTHORS",
20
- "CHANGELOG",
21
- "INSTALL",
22
- "README.rdoc",
23
- "Rakefile",
24
- "THANKS",
25
- "VERSION.yml",
26
- "demo/check_soa.rb",
27
- "demo/threads.rb",
28
- "lib/net/dns/dns.rb",
29
- "lib/net/dns/header.rb",
30
- "lib/net/dns/names/names.rb",
31
- "lib/net/dns/packet.rb",
32
- "lib/net/dns/question.rb",
33
- "lib/net/dns/resolver.rb",
34
- "lib/net/dns/resolver/socks.rb",
35
- "lib/net/dns/resolver/timeouts.rb",
36
- "lib/net/dns/rr.rb",
37
- "lib/net/dns/rr/a.rb",
38
- "lib/net/dns/rr/aaaa.rb",
39
- "lib/net/dns/rr/classes.rb",
40
- "lib/net/dns/rr/cname.rb",
41
- "lib/net/dns/rr/hinfo.rb",
42
- "lib/net/dns/rr/mr.rb",
43
- "lib/net/dns/rr/mx.rb",
44
- "lib/net/dns/rr/ns.rb",
45
- "lib/net/dns/rr/null.rb",
46
- "lib/net/dns/rr/ptr.rb",
47
- "lib/net/dns/rr/soa.rb",
48
- "lib/net/dns/rr/srv.rb",
49
- "lib/net/dns/rr/txt.rb",
50
- "lib/net/dns/rr/types.rb",
51
- "net-dns.gemspec",
52
- "setup.rb",
53
- "test/net/dns/resolver/test_timeouts.rb",
54
- "test/net/dns/rr/test_a.rb",
55
- "test/net/dns/rr/test_classes.rb",
56
- "test/net/dns/rr/test_ns.rb",
57
- "test/net/dns/rr/test_types.rb",
58
- "test/net/dns/test_header.rb",
59
- "test/net/dns/test_packet.rb",
60
- "test/net/dns/test_question.rb",
61
- "test/net/dns/test_resolver.rb",
62
- "test/net/dns/test_rr.rb"
63
- ]
64
- s.homepage = %q{http://github.com/bluemonk/net-dns}
65
- s.rdoc_options = ["--charset=UTF-8"]
66
- s.require_paths = ["lib"]
67
- s.rubyforge_project = %q{net-dns}
68
- s.rubygems_version = %q{1.3.3}
69
- s.summary = %q{Pure Ruby DNS library}
70
- s.test_files = [
71
- "test/net/dns/test_header.rb",
72
- "test/net/dns/rr/test_types.rb",
73
- "test/net/dns/rr/test_a.rb",
74
- "test/net/dns/rr/test_ns.rb",
75
- "test/net/dns/rr/test_classes.rb",
76
- "test/net/dns/resolver/test_timeouts.rb",
77
- "test/net/dns/test_rr.rb",
78
- "test/net/dns/test_packet.rb",
79
- "test/net/dns/test_question.rb",
80
- "test/net/dns/test_resolver.rb"
81
- ]
82
-
83
- if s.respond_to? :specification_version then
84
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
85
- s.specification_version = 3
86
-
87
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
88
- else
89
- end
90
- else
91
- end
92
- end
@@ -1,59 +0,0 @@
1
- require 'test/unit'
2
- require 'net/dns/resolver/timeouts.rb'
3
-
4
- class Test_DnsTimeout < Test::Unit::TestCase
5
-
6
- def test_tcp
7
- assert_equal(TcpTimeout.new(0).to_s,"infinite")
8
- assert_equal(TcpTimeout.new(30).to_s, "30")
9
- assert_equal(TcpTimeout.new(30).pretty_to_s, "30 seconds")
10
- assert_equal(TcpTimeout.new(90).pretty_to_s,
11
- "1 minutes and 30 seconds")
12
- assert_equal(TcpTimeout.new(3690).pretty_to_s,
13
- "1 hours, 1 minutes and 30 seconds")
14
- assert_equal(TcpTimeout.new(1).timeout {1+1}, 2)
15
- end
16
-
17
- def test_udp
18
- assert_equal(UdpTimeout.new(0).to_s,"not defined")
19
- assert_equal(UdpTimeout.new(30).to_s, "30")
20
- assert_equal(UdpTimeout.new(30).pretty_to_s, "30 seconds")
21
- assert_equal(UdpTimeout.new(90).pretty_to_s,
22
- "1 minutes and 30 seconds")
23
- assert_equal(UdpTimeout.new(3690).pretty_to_s,
24
- "1 hours, 1 minutes and 30 seconds")
25
- assert_equal(UdpTimeout.new(1).timeout {1+1}, 2)
26
- end
27
-
28
- def test_range_tcp
29
- assert_raise(DnsTimeoutArgumentError) do
30
- TcpTimeout.new("a")
31
- end
32
- assert_raise(DnsTimeoutArgumentError) do
33
- TcpTimeout.new(-1)
34
- end
35
- assert_raise(DnsTimeoutArgumentError) do
36
- TcpTimeout.new(1).timeout
37
- end
38
- assert_raise(TimeoutError) do
39
- TcpTimeout.new(0.1).timeout {sleep 2}
40
- end
41
- end
42
-
43
- def test_range_udp
44
- assert_raise(DnsTimeoutArgumentError) do
45
- UdpTimeout.new("a")
46
- end
47
- assert_raise(DnsTimeoutArgumentError) do
48
- UdpTimeout.new(-1)
49
- end
50
- assert_raise(DnsTimeoutArgumentError) do
51
- UdpTimeout.new(1).timeout
52
- end
53
- assert_raise(TimeoutError) do
54
- UdpTimeout.new(0.1).timeout {sleep 2}
55
- end
56
- end
57
-
58
- end
59
-
@@ -1,72 +0,0 @@
1
- require 'test/unit'
2
- require 'net/dns/rr'
3
-
4
- class Test_A < Test::Unit::TestCase
5
- def setup
6
-
7
- @name = "google.com."
8
- @type = "A"
9
- @cls = "IN"
10
- @ttl = 10800
11
- @address = "64.233.187.99"
12
-
13
-
14
- @hash = Net::DNS::RR::A.new(:name => @name,
15
- :address => @address)
16
-
17
- @string = Net::DNS::RR::A.new("google.com. 10800 IN A 64.233.187.99")
18
-
19
- @arr = Net::DNS::RR.parse(@string.data)
20
-
21
- @str = "google.com. 10800 IN A 64.233.187.99"
22
- end
23
-
24
- def test_simple
25
- assert_equal(@str,@hash.inspect)
26
- assert_equal(@name, @hash.name)
27
- assert_equal(@type, @hash.type)
28
- assert_equal(@cls, @hash.cls)
29
- assert_equal(@ttl, @hash.ttl)
30
- assert_equal(@address, @hash.address.to_s)
31
-
32
- assert_equal(@str, @string.inspect)
33
- assert_equal(@name, @string.name)
34
- assert_equal(@type, @string.type)
35
- assert_equal(@cls, @string.cls)
36
- assert_equal(@ttl, @string.ttl)
37
- assert_equal(@address, @string.address.to_s)
38
-
39
- assert_equal(@str, @arr.inspect)
40
- assert_equal(@name, @arr.name)
41
- assert_equal(@type, @arr.type)
42
- assert_equal(@cls, @arr.cls)
43
- assert_equal(@ttl, @arr.ttl)
44
- assert_equal(@address, @arr.address.to_s)
45
- end
46
-
47
- def test_range
48
- assert_raise(RRArgumentError) do
49
- Net::DNS::RR::A.new(:name => "google.com",
50
- :address => "255.256")
51
- end
52
- assert_raise(RRArgumentError) do
53
- Net::DNS::RR::A.new(:name => "google.com")
54
- end
55
- assert_raise(RRArgumentError) do
56
- Net::DNS::RR::A.new(Object.new)
57
- end
58
- assert_raise(RRArgumentError) do
59
- Net::DNS::RR::A.new(Array.new(7))
60
- end
61
- assert_raise(RRArgumentError) do
62
- Net::DNS::RR::A.new("10800 IN A")
63
- end
64
- assert_raise(RRArgumentError) do
65
- Net::DNS::RR::A.new("google.com. 10800 IN B")
66
- end
67
- assert_raise(RRArgumentError) do
68
- Net::DNS::RR::A.new("google.com. 10800 IM A")
69
- end
70
- end
71
- end
72
-