net-dns 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +6 -14
  2. data/.gitignore +1 -1
  3. data/.rspec +1 -0
  4. data/.rubocop.yml +3 -0
  5. data/.rubocop_defaults.yml +364 -0
  6. data/.rubocop_todo.yml +207 -0
  7. data/.travis.yml +9 -16
  8. data/CHANGELOG.md +12 -1
  9. data/Gemfile +6 -2
  10. data/LICENSE.txt +56 -0
  11. data/README.md +94 -77
  12. data/Rakefile +23 -56
  13. data/bin/console +14 -0
  14. data/demo/check_soa.rb +27 -38
  15. data/demo/threads.rb +3 -7
  16. data/lib/net/dns.rb +4 -11
  17. data/lib/net/dns/core_ext.rb +8 -15
  18. data/lib/net/dns/header.rb +58 -66
  19. data/lib/net/dns/names.rb +25 -23
  20. data/lib/net/dns/packet.rb +136 -139
  21. data/lib/net/dns/question.rb +36 -39
  22. data/lib/net/dns/resolver.rb +103 -113
  23. data/lib/net/dns/resolver/socks.rb +45 -51
  24. data/lib/net/dns/resolver/timeouts.rb +17 -26
  25. data/lib/net/dns/rr.rb +107 -117
  26. data/lib/net/dns/rr/a.rb +46 -55
  27. data/lib/net/dns/rr/aaaa.rb +40 -49
  28. data/lib/net/dns/rr/classes.rb +26 -29
  29. data/lib/net/dns/rr/cname.rb +33 -41
  30. data/lib/net/dns/rr/hinfo.rb +44 -56
  31. data/lib/net/dns/rr/mr.rb +33 -42
  32. data/lib/net/dns/rr/mx.rb +37 -47
  33. data/lib/net/dns/rr/ns.rb +33 -41
  34. data/lib/net/dns/rr/null.rb +8 -11
  35. data/lib/net/dns/rr/ptr.rb +14 -20
  36. data/lib/net/dns/rr/soa.rb +27 -30
  37. data/lib/net/dns/rr/srv.rb +13 -17
  38. data/lib/net/dns/rr/txt.rb +8 -11
  39. data/lib/net/dns/rr/types.rb +97 -99
  40. data/lib/net/dns/version.rb +5 -13
  41. data/net-dns.gemspec +17 -29
  42. data/{fixtures → spec/fixtures}/resolv.conf +0 -0
  43. data/spec/spec_helper.rb +14 -0
  44. data/spec/unit/resolver/dns_timeout_spec.rb +36 -0
  45. data/spec/unit/resolver/tcp_timeout_spec.rb +46 -0
  46. data/spec/unit/resolver/udp_timeout_spec.rb +46 -0
  47. data/test/test_helper.rb +12 -3
  48. data/test/{header_test.rb → unit/header_test.rb} +43 -46
  49. data/test/{names_test.rb → unit/names_test.rb} +1 -1
  50. data/test/{packet_test.rb → unit/packet_test.rb} +3 -5
  51. data/test/{question_test.rb → unit/question_test.rb} +3 -5
  52. data/test/{resolver_test.rb → unit/resolver_test.rb} +10 -13
  53. data/test/{rr → unit/rr}/a_test.rb +10 -17
  54. data/test/{rr → unit/rr}/aaaa_test.rb +7 -14
  55. data/test/{rr → unit/rr}/classes_test.rb +14 -16
  56. data/test/{rr → unit/rr}/cname_test.rb +7 -14
  57. data/test/{rr → unit/rr}/hinfo_test.rb +16 -22
  58. data/test/{rr → unit/rr}/mr_test.rb +12 -18
  59. data/test/{rr → unit/rr}/mx_test.rb +18 -24
  60. data/test/{rr → unit/rr}/ns_test.rb +10 -16
  61. data/test/{rr → unit/rr}/types_test.rb +10 -8
  62. data/test/{rr_test.rb → unit/rr_test.rb} +33 -37
  63. metadata +77 -49
  64. data/test/resolver/timeouts_test.rb +0 -109
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-dns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Ceresa
@@ -9,34 +9,48 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-08 00:00:00.000000000 Z
12
+ date: 2018-10-29 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: mocha
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
14
28
  - !ruby/object:Gem::Dependency
15
29
  name: rake
16
30
  requirement: !ruby/object:Gem::Requirement
17
31
  requirements:
18
- - - ~>
32
+ - - ">="
19
33
  - !ruby/object:Gem::Version
20
- version: '10.0'
34
+ version: '0'
21
35
  type: :development
22
36
  prerelease: false
23
37
  version_requirements: !ruby/object:Gem::Requirement
24
38
  requirements:
25
- - - ~>
39
+ - - ">="
26
40
  - !ruby/object:Gem::Version
27
- version: '10.0'
41
+ version: '0'
28
42
  - !ruby/object:Gem::Dependency
29
43
  name: yard
30
44
  requirement: !ruby/object:Gem::Requirement
31
45
  requirements:
32
- - - ! '>='
46
+ - - ">="
33
47
  - !ruby/object:Gem::Version
34
48
  version: '0'
35
49
  type: :development
36
50
  prerelease: false
37
51
  version_requirements: !ruby/object:Gem::Requirement
38
52
  requirements:
39
- - - ! '>='
53
+ - - ">="
40
54
  - !ruby/object:Gem::Version
41
55
  version: '0'
42
56
  description: Net::DNS is a pure Ruby DNS library, with a clean OO interface and an
@@ -46,18 +60,24 @@ email:
46
60
  - weppos@weppos.net
47
61
  executables: []
48
62
  extensions: []
49
- extra_rdoc_files: []
63
+ extra_rdoc_files:
64
+ - LICENSE.txt
50
65
  files:
51
- - .gitignore
52
- - .travis.yml
66
+ - ".gitignore"
67
+ - ".rspec"
68
+ - ".rubocop.yml"
69
+ - ".rubocop_defaults.yml"
70
+ - ".rubocop_todo.yml"
71
+ - ".travis.yml"
53
72
  - CHANGELOG.md
54
73
  - Gemfile
74
+ - LICENSE.txt
55
75
  - README.md
56
76
  - Rakefile
57
77
  - THANKS.rdoc
78
+ - bin/console
58
79
  - demo/check_soa.rb
59
80
  - demo/threads.rb
60
- - fixtures/resolv.conf
61
81
  - lib/net/dns.rb
62
82
  - lib/net/dns/core_ext.rb
63
83
  - lib/net/dns/header.rb
@@ -84,23 +104,27 @@ files:
84
104
  - lib/net/dns/rr/types.rb
85
105
  - lib/net/dns/version.rb
86
106
  - net-dns.gemspec
87
- - test/header_test.rb
88
- - test/names_test.rb
89
- - test/packet_test.rb
90
- - test/question_test.rb
91
- - test/resolver/timeouts_test.rb
92
- - test/resolver_test.rb
93
- - test/rr/a_test.rb
94
- - test/rr/aaaa_test.rb
95
- - test/rr/classes_test.rb
96
- - test/rr/cname_test.rb
97
- - test/rr/hinfo_test.rb
98
- - test/rr/mr_test.rb
99
- - test/rr/mx_test.rb
100
- - test/rr/ns_test.rb
101
- - test/rr/types_test.rb
102
- - test/rr_test.rb
107
+ - spec/fixtures/resolv.conf
108
+ - spec/spec_helper.rb
109
+ - spec/unit/resolver/dns_timeout_spec.rb
110
+ - spec/unit/resolver/tcp_timeout_spec.rb
111
+ - spec/unit/resolver/udp_timeout_spec.rb
103
112
  - test/test_helper.rb
113
+ - test/unit/header_test.rb
114
+ - test/unit/names_test.rb
115
+ - test/unit/packet_test.rb
116
+ - test/unit/question_test.rb
117
+ - test/unit/resolver_test.rb
118
+ - test/unit/rr/a_test.rb
119
+ - test/unit/rr/aaaa_test.rb
120
+ - test/unit/rr/classes_test.rb
121
+ - test/unit/rr/cname_test.rb
122
+ - test/unit/rr/hinfo_test.rb
123
+ - test/unit/rr/mr_test.rb
124
+ - test/unit/rr/mx_test.rb
125
+ - test/unit/rr/ns_test.rb
126
+ - test/unit/rr/types_test.rb
127
+ - test/unit/rr_test.rb
104
128
  homepage: http://github.com/bluemonk/net-dns
105
129
  licenses: []
106
130
  metadata: {}
@@ -110,35 +134,39 @@ require_paths:
110
134
  - lib
111
135
  required_ruby_version: !ruby/object:Gem::Requirement
112
136
  requirements:
113
- - - ! '>='
137
+ - - ">="
114
138
  - !ruby/object:Gem::Version
115
- version: 1.8.7
139
+ version: '2.1'
116
140
  required_rubygems_version: !ruby/object:Gem::Requirement
117
141
  requirements:
118
- - - ! '>='
142
+ - - ">="
119
143
  - !ruby/object:Gem::Version
120
144
  version: '0'
121
145
  requirements: []
122
- rubyforge_project: net-dns
123
- rubygems_version: 2.0.3
146
+ rubyforge_project:
147
+ rubygems_version: 2.7.3
124
148
  signing_key:
125
149
  specification_version: 4
126
150
  summary: Pure Ruby DNS library.
127
151
  test_files:
128
- - test/header_test.rb
129
- - test/names_test.rb
130
- - test/packet_test.rb
131
- - test/question_test.rb
132
- - test/resolver/timeouts_test.rb
133
- - test/resolver_test.rb
134
- - test/rr/a_test.rb
135
- - test/rr/aaaa_test.rb
136
- - test/rr/classes_test.rb
137
- - test/rr/cname_test.rb
138
- - test/rr/hinfo_test.rb
139
- - test/rr/mr_test.rb
140
- - test/rr/mx_test.rb
141
- - test/rr/ns_test.rb
142
- - test/rr/types_test.rb
143
- - test/rr_test.rb
152
+ - spec/fixtures/resolv.conf
153
+ - spec/spec_helper.rb
154
+ - spec/unit/resolver/dns_timeout_spec.rb
155
+ - spec/unit/resolver/tcp_timeout_spec.rb
156
+ - spec/unit/resolver/udp_timeout_spec.rb
144
157
  - test/test_helper.rb
158
+ - test/unit/header_test.rb
159
+ - test/unit/names_test.rb
160
+ - test/unit/packet_test.rb
161
+ - test/unit/question_test.rb
162
+ - test/unit/resolver_test.rb
163
+ - test/unit/rr/a_test.rb
164
+ - test/unit/rr/aaaa_test.rb
165
+ - test/unit/rr/classes_test.rb
166
+ - test/unit/rr/cname_test.rb
167
+ - test/unit/rr/hinfo_test.rb
168
+ - test/unit/rr/mr_test.rb
169
+ - test/unit/rr/mx_test.rb
170
+ - test/unit/rr/ns_test.rb
171
+ - test/unit/rr/types_test.rb
172
+ - test/unit/rr_test.rb
@@ -1,109 +0,0 @@
1
- require 'test_helper'
2
- require 'net/dns/resolver/timeouts'
3
-
4
- class DnsTimeoutTest < Test::Unit::TestCase
5
-
6
- def setup
7
- @klass = Net::DNS::Resolver::DnsTimeout
8
- end
9
-
10
- def test_initialize
11
- timeout = @klass.new(0)
12
- assert_instance_of @klass, timeout
13
- end
14
-
15
- def test_initialize_should_set_timeout
16
- assert_equal 0, @klass.new(0).seconds
17
- assert_equal 10, @klass.new(10).seconds
18
- end
19
-
20
- def test_initialize_should_set_raise_with_invalid_timeout
21
- assert_raises(ArgumentError) { @klass.new(nil) }
22
- assert_raises(ArgumentError) { @klass.new("") }
23
- assert_raises(ArgumentError) { @klass.new("foo") }
24
- assert_raises(ArgumentError) { @klass.new(-1) }
25
- end
26
-
27
-
28
- def test_to_s
29
- assert_equal "", @klass.new(0).to_s
30
- assert_equal "1", @klass.new(1).to_s
31
- assert_equal "10", @klass.new(10).to_s
32
- end
33
-
34
-
35
- def test_timeout_should_raise_localjumperror_without_block
36
- assert_raises(LocalJumpError) { @klass.new(1).timeout }
37
- end
38
-
39
- end
40
-
41
- class TcpTimeoutTest < Test::Unit::TestCase
42
-
43
- def test_initialize
44
- assert_raises(ArgumentError) do
45
- Net::DNS::Resolver::TcpTimeout.new("a")
46
- end
47
- assert_raises(ArgumentError) do
48
- Net::DNS::Resolver::TcpTimeout.new(-1)
49
- end
50
- assert_raises(TimeoutError) do
51
- Net::DNS::Resolver::TcpTimeout.new(0.1).timeout { sleep 2 }
52
- end
53
- end
54
-
55
- def test_to_s
56
- assert_equal "infinite", Net::DNS::Resolver::TcpTimeout.new(0).to_s
57
- assert_equal "30", Net::DNS::Resolver::TcpTimeout.new(30).to_s
58
- end
59
-
60
- def test_pretty_to_s
61
- assert_equal "30 seconds", Net::DNS::Resolver::TcpTimeout.new(30).pretty_to_s
62
- assert_equal "1 minutes and 30 seconds", Net::DNS::Resolver::TcpTimeout.new(90).pretty_to_s
63
- assert_equal "1 hours, 1 minutes and 30 seconds", Net::DNS::Resolver::TcpTimeout.new(3690).pretty_to_s
64
- end
65
-
66
- def test_timeout
67
- assert_equal 2, Net::DNS::Resolver::TcpTimeout.new(1).timeout { 1 + 1 }
68
- end
69
-
70
- def test_timeout_should_raise_localjumperror_without_block
71
- assert_raises(LocalJumpError) { Net::DNS::Resolver::TcpTimeout.new(1).timeout }
72
- end
73
-
74
- end
75
-
76
- class UdpTimeoutTest < Test::Unit::TestCase
77
-
78
- def test_initialize
79
- assert_raises(ArgumentError) do
80
- Net::DNS::Resolver::UdpTimeout.new("a")
81
- end
82
- assert_raises(ArgumentError) do
83
- Net::DNS::Resolver::UdpTimeout.new(-1)
84
- end
85
- assert_raises(TimeoutError) do
86
- Net::DNS::Resolver::UdpTimeout.new(0.1).timeout {sleep 2}
87
- end
88
- end
89
-
90
- def test_to_s
91
- assert_equal "not defined", Net::DNS::Resolver::UdpTimeout.new(0).to_s
92
- assert_equal "30", Net::DNS::Resolver::UdpTimeout.new(30).to_s
93
- end
94
-
95
- def test_pretty_to_s
96
- assert_equal "30 seconds", Net::DNS::Resolver::UdpTimeout.new(30).pretty_to_s
97
- assert_equal "1 minutes and 30 seconds", Net::DNS::Resolver::UdpTimeout.new(90).pretty_to_s
98
- assert_equal "1 hours, 1 minutes and 30 seconds", Net::DNS::Resolver::UdpTimeout.new(3690).pretty_to_s
99
- end
100
-
101
- def test_timeout
102
- assert_equal 2, Net::DNS::Resolver::UdpTimeout.new(1).timeout { 1 + 1 }
103
- end
104
-
105
- def test_timeout_should_raise_localjumperror_without_block
106
- assert_raises(LocalJumpError) { Net::DNS::Resolver::UdpTimeout.new(1).timeout }
107
- end
108
-
109
- end