net-dns 0.9.0 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -16
- data/README.md +1 -1
- data/lib/net/dns/header.rb +48 -64
- data/lib/net/dns/names.rb +8 -10
- data/lib/net/dns/packet.rb +46 -53
- data/lib/net/dns/question.rb +5 -3
- data/lib/net/dns/resolver/socks.rb +5 -7
- data/lib/net/dns/resolver/timeouts.rb +3 -5
- data/lib/net/dns/resolver.rb +54 -69
- data/lib/net/dns/rr/a.rb +3 -4
- data/lib/net/dns/rr/aaaa.rb +3 -5
- data/lib/net/dns/rr/classes.rb +6 -8
- data/lib/net/dns/rr/cname.rb +3 -5
- data/lib/net/dns/rr/hinfo.rb +9 -13
- data/lib/net/dns/rr/mr.rb +3 -5
- data/lib/net/dns/rr/mx.rb +5 -7
- data/lib/net/dns/rr/ns.rb +3 -5
- data/lib/net/dns/rr/null.rb +3 -5
- data/lib/net/dns/rr/ptr.rb +3 -5
- data/lib/net/dns/rr/soa.rb +11 -7
- data/lib/net/dns/rr/srv.rb +5 -2
- data/lib/net/dns/rr/txt.rb +4 -6
- data/lib/net/dns/rr/types.rb +90 -79
- data/lib/net/dns/rr.rb +2 -2
- data/lib/net/dns/version.rb +1 -1
- data/lib/net/dns.rb +3 -1
- metadata +11 -104
- data/.gitignore +0 -8
- data/.rubocop.yml +0 -3
- data/.rubocop_defaults.yml +0 -364
- data/.rubocop_todo.yml +0 -207
- data/Gemfile +0 -8
- data/Rakefile +0 -38
- data/bin/console +0 -14
- data/lib/net/dns/core_ext.rb +0 -45
- data/net-dns.gemspec +0 -23
- data/spec/fixtures/resolv.conf +0 -4
- data/spec/spec_helper.rb +0 -14
- data/spec/unit/resolver/dns_timeout_spec.rb +0 -36
- data/spec/unit/resolver/tcp_timeout_spec.rb +0 -46
- data/spec/unit/resolver/udp_timeout_spec.rb +0 -46
- data/test/test_helper.rb +0 -13
- data/test/unit/header_test.rb +0 -164
- data/test/unit/names_test.rb +0 -21
- data/test/unit/packet_test.rb +0 -47
- data/test/unit/question_test.rb +0 -81
- data/test/unit/resolver_test.rb +0 -114
- data/test/unit/rr/a_test.rb +0 -106
- data/test/unit/rr/aaaa_test.rb +0 -102
- data/test/unit/rr/classes_test.rb +0 -83
- data/test/unit/rr/cname_test.rb +0 -90
- data/test/unit/rr/hinfo_test.rb +0 -111
- data/test/unit/rr/mr_test.rb +0 -99
- data/test/unit/rr/mx_test.rb +0 -106
- data/test/unit/rr/ns_test.rb +0 -80
- data/test/unit/rr/types_test.rb +0 -71
- data/test/unit/rr_test.rb +0 -127
data/lib/net/dns/rr/types.rb
CHANGED
@@ -4,65 +4,82 @@ module Net # :nodoc:
|
|
4
4
|
# This is an auxiliary class to handle RR type field in a DNS packet.
|
5
5
|
class Types
|
6
6
|
TYPES = {
|
7
|
-
'SIGZERO' => 0,
|
8
|
-
'A' => 1,
|
9
|
-
'NS' => 2,
|
10
|
-
'MD' => 3,
|
11
|
-
'MF' => 4,
|
12
|
-
'CNAME' => 5,
|
13
|
-
'SOA' => 6,
|
14
|
-
'MB' => 7,
|
15
|
-
'MG' => 8,
|
16
|
-
'MR' => 9,
|
17
|
-
'NULL' => 10,
|
18
|
-
'WKS' => 11,
|
19
|
-
'PTR' => 12,
|
7
|
+
'SIGZERO' => 0, # RFC2931 consider this a pseudo type
|
8
|
+
'A' => 1, # RFC 1035, Section 3.4.1
|
9
|
+
'NS' => 2, # RFC 1035, Section 3.3.11
|
10
|
+
'MD' => 3, # RFC 1035, Section 3.3.4 (obsolete)
|
11
|
+
'MF' => 4, # RFC 1035, Section 3.3.5 (obsolete)
|
12
|
+
'CNAME' => 5, # RFC 1035, Section 3.3.1
|
13
|
+
'SOA' => 6, # RFC 1035, Section 3.3.13
|
14
|
+
'MB' => 7, # RFC 1035, Section 3.3.3 (obsolete)
|
15
|
+
'MG' => 8, # RFC 1035, Section 3.3.6 (obsolete)
|
16
|
+
'MR' => 9, # RFC 1035, Section 3.3.8 (obsolete)
|
17
|
+
'NULL' => 10, # RFC 1035, Section 3.3.10 (obsolete)
|
18
|
+
'WKS' => 11, # RFC 1035, Section 3.4.2 (obsolete)
|
19
|
+
'PTR' => 12, # RFC 1035, Section 3.3.12
|
20
20
|
'HINFO' => 13, # RFC 1035, Section 3.3.2
|
21
|
-
'MINFO' => 14, # RFC 1035, Section 3.3.7
|
22
|
-
'MX' => 15,
|
23
|
-
'TXT' => 16,
|
24
|
-
'RP' => 17,
|
25
|
-
'AFSDB' => 18,
|
26
|
-
'X25' => 19,
|
27
|
-
'ISDN' => 20,
|
28
|
-
'RT' => 21,
|
29
|
-
'NSAP' => 22,
|
30
|
-
'NSAP_PTR' => 23,
|
31
|
-
|
32
|
-
'
|
33
|
-
'
|
34
|
-
'
|
35
|
-
'
|
36
|
-
'
|
37
|
-
'
|
38
|
-
|
39
|
-
'
|
40
|
-
'
|
41
|
-
'
|
42
|
-
'
|
43
|
-
'
|
44
|
-
'
|
45
|
-
'
|
46
|
-
'
|
47
|
-
'
|
48
|
-
'
|
49
|
-
|
50
|
-
'
|
51
|
-
'
|
52
|
-
'
|
53
|
-
'
|
54
|
-
'
|
55
|
-
'
|
56
|
-
'
|
57
|
-
'
|
58
|
-
'
|
59
|
-
'
|
60
|
-
'
|
61
|
-
'
|
62
|
-
'
|
63
|
-
'
|
21
|
+
'MINFO' => 14, # RFC 1035, Section 3.3.7 (obsolete)
|
22
|
+
'MX' => 15, # RFC 1035, Section 3.3.9
|
23
|
+
'TXT' => 16, # RFC 1035, Section 3.3.14
|
24
|
+
'RP' => 17, # RFC 1183, Section 2.2 (obsolete)
|
25
|
+
'AFSDB' => 18, # RFC 1183, Section 1
|
26
|
+
'X25' => 19, # RFC 1183, Section 3.1 (obsolete)
|
27
|
+
'ISDN' => 20, # RFC 1183, Section 3.2 (obsolete)
|
28
|
+
'RT' => 21, # RFC 1183, Section 3.3 (obsolete)
|
29
|
+
'NSAP' => 22, # RFC 1706, Section 5 (obsolete)
|
30
|
+
'NSAP_PTR' => 23, # RFC 1348 (obsolete) (obsolete)
|
31
|
+
'SIG' => 24, # RFC 2535, Section 4.1 (obsolete)
|
32
|
+
'KEY' => 25, # RFC 2535, Section 3.1 (obsolete)
|
33
|
+
'PX' => 26, # RFC 2163, (obsolete)
|
34
|
+
'GPOS' => 27, # RFC 1712 (obsolete)
|
35
|
+
'AAAA' => 28, # RFC 1886, Section 2.1
|
36
|
+
'LOC' => 29, # RFC 1876
|
37
|
+
'NXT' => 30, # RFC 2535, Section 5.2 (obsolete)
|
38
|
+
'EID' => 31, # draft-ietf-nimrod-dns-xx.txt (obsolete)
|
39
|
+
'NIMLOC' => 32, # draft-ietf-nimrod-dns-xx.txt (obsolete)
|
40
|
+
'SRV' => 33, # RFC 2052
|
41
|
+
'ATMA' => 34, # ??? (obsolete)
|
42
|
+
'NAPTR' => 35, # RFC 2168
|
43
|
+
'KX' => 36, # RFC 2230
|
44
|
+
'CERT' => 37, # RFC 2538
|
45
|
+
'DNAME' => 39, # RFC 2672
|
46
|
+
'OPT' => 41, # RFC 2671
|
47
|
+
'APL' => 42, # RFC 3123 (obsolete)
|
48
|
+
'DS' => 43, # RFC 4034
|
49
|
+
'SSHFP' => 44, # RFC 4255
|
50
|
+
'IPSECKEY' => 45, # RFC 4025
|
51
|
+
'RRSIG' => 46, # RFC 4034
|
52
|
+
'NSEC' => 47, # RFC 4034
|
53
|
+
'DNSKEY' => 48, # RFC 4034
|
54
|
+
'DHCID' => 49, # RFC 4701
|
55
|
+
'NSEC3' => 50, # RFC 5155
|
56
|
+
'NSEC3PARAM' => 51, # RFC 5155
|
57
|
+
'TLSA' => 52, # RFC 6698
|
58
|
+
'SMIMEA' => 53, # RFC 8162
|
59
|
+
'HIP' => 55, # RFC 8005
|
60
|
+
'CDS' => 59, # RFC 7344
|
61
|
+
'CDNSKEY' => 60, # RFC 7344
|
62
|
+
'OPENPGPKEY' => 61, # RFC 7929
|
63
|
+
'CSYNC' => 62, # RFC 7477
|
64
|
+
'ZONEMD' => 63, # RFC 8976
|
65
|
+
'SVCB' => 64, # RFC 9460
|
66
|
+
'HTTPS' => 65, # RFC 9460
|
67
|
+
'SPF' => 99, # RFC 4408 (obsolete)
|
68
|
+
'UINFO' => 100, # non-standard (obsolete)
|
69
|
+
'UID' => 101, # non-standard (obsolete)
|
70
|
+
'GID' => 102, # non-standard (obsolete)
|
71
|
+
'UNSPEC' => 103, # non-standard (obsolete)
|
72
|
+
'EUI48' => 108, # RFC 7043
|
73
|
+
'EUI64' => 109, # RFC 7043
|
74
|
+
'TKEY' => 249, # RFC 2930
|
75
|
+
'TSIG' => 250, # RFC 2931
|
76
|
+
'IXFR' => 251, # RFC 1995
|
77
|
+
'AXFR' => 252, # RFC 1035
|
78
|
+
'MAILB' => 253, # RFC 1035 (MB, MG, MR) (obsolete)
|
64
79
|
'MAILA' => 254, # RFC 1035 (obsolete - see MX)
|
65
|
-
'ANY' => 255,
|
80
|
+
'ANY' => 255, # RFC 1035
|
81
|
+
'URI' => 256, # RFC 7553
|
82
|
+
'CAA' => 257, # RFC 6844
|
66
83
|
}.freeze
|
67
84
|
|
68
85
|
# The default value when type is nil in Resource Records
|
@@ -75,11 +92,9 @@ module Net # :nodoc:
|
|
75
92
|
# Be able to control the default type to assign when
|
76
93
|
# type is +nil+. Default to +A+
|
77
94
|
def self.default=(str)
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
raise ArgumentError, "Unknown type #{str}"
|
82
|
-
end
|
95
|
+
raise ArgumentError, "Unknown type #{str}" unless TYPES.key? str
|
96
|
+
|
97
|
+
@@default = TYPES[str]
|
83
98
|
end
|
84
99
|
|
85
100
|
# Checks whether +type+ is a valid RR type.
|
@@ -99,11 +114,10 @@ module Net # :nodoc:
|
|
99
114
|
def self.to_str(type)
|
100
115
|
case type
|
101
116
|
when Integer
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
end
|
117
|
+
raise ArgumentError, "Unknown type number #{type}" unless TYPES.invert.key? type
|
118
|
+
|
119
|
+
TYPES.invert[type]
|
120
|
+
|
107
121
|
else
|
108
122
|
raise ArgumentError, "Wrong type class: #{type.class}"
|
109
123
|
end
|
@@ -167,23 +181,20 @@ module Net # :nodoc:
|
|
167
181
|
# TODO!!!
|
168
182
|
else
|
169
183
|
# String with name of type
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
end
|
184
|
+
raise ArgumentError, "Unknown type #{type}" unless TYPES.key? type
|
185
|
+
|
186
|
+
@str = type
|
187
|
+
@num = TYPES[type]
|
188
|
+
|
176
189
|
end
|
177
190
|
end
|
178
191
|
|
179
192
|
# Contructor for numeric data type.
|
180
193
|
def new_from_num(type)
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
raise ArgumentError, "Unkown type number #{type}"
|
186
|
-
end
|
194
|
+
raise ArgumentError, "Unkown type number #{type}" unless TYPES.invert.key? type
|
195
|
+
|
196
|
+
@num = type
|
197
|
+
@str = TYPES.invert[type]
|
187
198
|
end
|
188
199
|
end
|
189
200
|
end
|
data/lib/net/dns/rr.rb
CHANGED
@@ -284,7 +284,7 @@ module Net
|
|
284
284
|
if self.class == Net::DNS::RR
|
285
285
|
Net::DNS::RR.const_get(@type.to_s).new(args)
|
286
286
|
else
|
287
|
-
hash = args
|
287
|
+
hash = args.delete_if { |k, _| %i[name ttl type cls].include?(k) }
|
288
288
|
if hash.key? :rdata
|
289
289
|
subclass_new_from_string(hash[:rdata])
|
290
290
|
else
|
@@ -297,7 +297,7 @@ module Net
|
|
297
297
|
def new_from_binary(data, offset)
|
298
298
|
if self.class == Net::DNS::RR
|
299
299
|
temp = dn_expand(data, offset)[1]
|
300
|
-
type = Net::DNS::RR::Types.new data.
|
300
|
+
type = Net::DNS::RR::Types.new data.unpack1("@#{temp} n")
|
301
301
|
(eval "Net::DNS::RR::#{type}").parse_packet(data, offset)
|
302
302
|
else
|
303
303
|
@name, offset = dn_expand(data, offset)
|
data/lib/net/dns/version.rb
CHANGED
data/lib/net/dns.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require_relative 'dns/version'
|
2
|
-
require_relative 'dns/core_ext'
|
3
2
|
require_relative 'dns/resolver'
|
4
3
|
require_relative 'dns/rr'
|
5
4
|
|
@@ -69,6 +68,7 @@ module Net
|
|
69
68
|
RRSIG = 46
|
70
69
|
NSEC = 47
|
71
70
|
DNSKEY = 48
|
71
|
+
SPF = 99
|
72
72
|
UINFO = 100
|
73
73
|
UID = 101
|
74
74
|
GID = 102
|
@@ -80,6 +80,8 @@ module Net
|
|
80
80
|
MAILB = 253
|
81
81
|
MAILA = 254
|
82
82
|
ANY = 255
|
83
|
+
URI = 256
|
84
|
+
CAA = 257
|
83
85
|
end
|
84
86
|
|
85
87
|
module QueryClasses
|
metadata
CHANGED
@@ -1,58 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-dns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marco Ceresa
|
8
8
|
- Simone Carletti
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
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'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: rake
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: yard
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
12
|
+
date: 2023-12-18 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
56
14
|
description: Net::DNS is a pure Ruby DNS library, with a clean OO interface and an
|
57
15
|
extensible API.
|
58
16
|
email:
|
@@ -63,23 +21,15 @@ extensions: []
|
|
63
21
|
extra_rdoc_files:
|
64
22
|
- LICENSE.txt
|
65
23
|
files:
|
66
|
-
- ".gitignore"
|
67
24
|
- ".rspec"
|
68
|
-
- ".rubocop.yml"
|
69
|
-
- ".rubocop_defaults.yml"
|
70
|
-
- ".rubocop_todo.yml"
|
71
25
|
- ".travis.yml"
|
72
26
|
- CHANGELOG.md
|
73
|
-
- Gemfile
|
74
27
|
- LICENSE.txt
|
75
28
|
- README.md
|
76
|
-
- Rakefile
|
77
29
|
- THANKS.rdoc
|
78
|
-
- bin/console
|
79
30
|
- demo/check_soa.rb
|
80
31
|
- demo/threads.rb
|
81
32
|
- lib/net/dns.rb
|
82
|
-
- lib/net/dns/core_ext.rb
|
83
33
|
- lib/net/dns/header.rb
|
84
34
|
- lib/net/dns/names.rb
|
85
35
|
- lib/net/dns/packet.rb
|
@@ -103,32 +53,11 @@ files:
|
|
103
53
|
- lib/net/dns/rr/txt.rb
|
104
54
|
- lib/net/dns/rr/types.rb
|
105
55
|
- lib/net/dns/version.rb
|
106
|
-
- net-dns.gemspec
|
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
|
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
|
128
56
|
homepage: http://github.com/bluemonk/net-dns
|
129
|
-
licenses:
|
57
|
+
licenses:
|
58
|
+
- Ruby
|
130
59
|
metadata: {}
|
131
|
-
post_install_message:
|
60
|
+
post_install_message:
|
132
61
|
rdoc_options: []
|
133
62
|
require_paths:
|
134
63
|
- lib
|
@@ -136,37 +65,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
65
|
requirements:
|
137
66
|
- - ">="
|
138
67
|
- !ruby/object:Gem::Version
|
139
|
-
version: '2.
|
68
|
+
version: '2.6'
|
140
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
70
|
requirements:
|
142
71
|
- - ">="
|
143
72
|
- !ruby/object:Gem::Version
|
144
73
|
version: '0'
|
145
74
|
requirements: []
|
146
|
-
|
147
|
-
|
148
|
-
signing_key:
|
75
|
+
rubygems_version: 3.4.21
|
76
|
+
signing_key:
|
149
77
|
specification_version: 4
|
150
78
|
summary: Pure Ruby DNS library.
|
151
|
-
test_files:
|
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
|
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
|
79
|
+
test_files: []
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED