svcb_rr_patch 0.0.3 → 0.0.4
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 +4 -4
- data/README.md +1 -10
- data/lib/svcb_rr_patch/svc_params/alpn.rb +5 -0
- data/lib/svcb_rr_patch/svc_params/ipv4hint.rb +5 -0
- data/lib/svcb_rr_patch/svc_params/ipv6hint.rb +5 -0
- data/lib/svcb_rr_patch/svc_params/mandatory.rb +14 -1
- data/lib/svcb_rr_patch/svc_params/port.rb +5 -0
- data/lib/svcb_rr_patch/svc_params.rb +3 -3
- data/lib/svcb_rr_patch/version.rb +1 -1
- data/spec/alpn_spec.rb +1 -0
- data/spec/ipv4hint_spec.rb +6 -5
- data/spec/ipv6hint_spec.rb +13 -4
- data/spec/mandatory_spec.rb +3 -2
- data/spec/no_default_alpn_spec.rb +1 -0
- data/spec/port_spec.rb +1 -0
- data/spec/svc_params_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 607172ae2b63afd7c66a3cfe87456873eb1f436c28f0380a52edeeb31d9f3902
|
4
|
+
data.tar.gz: b8a3b83f4820b78fb3efcb27b675a3cf07a58f360fe7d3c3a93fdd7161ced077
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7125f6c9205f872a12574801bf5026073cd4d028640afbaefdf2a2ee69f11cc832167d4612341c475605306705af0742bb724fc241f482c85af8fe1e8a4f61d1
|
7
|
+
data.tar.gz: 9217eca73420740086db7877bd5ff05e024ece6f6ecda1ad0d6b30e50cb1966da733b32f3daab8518a1180d25c6a0de1a8c7dab4105e132e186ae21a956e419b
|
data/README.md
CHANGED
@@ -36,16 +36,7 @@ irb(main):004:1* Resolv::DNS::Resource::IN::HTTPS
|
|
36
36
|
irb(main):005:0> )
|
37
37
|
=>
|
38
38
|
[#<Resolv::DNS::Resource::IN::HTTPS:0x0000000000000001
|
39
|
-
@svc_params=
|
40
|
-
{"alpn"=>
|
41
|
-
#<SvcbRrPatch::SvcParams::Alpn:0x0000000000000002
|
42
|
-
@protocols=["h3", "h3-29", "h3-28", "h3-27", "h2"]>,
|
43
|
-
"ipv4hint"=>
|
44
|
-
#<SvcbRrPatch::SvcParams::Ipv4hint:0x0000000000000003
|
45
|
-
@addresses=[#<Resolv::IPv4 104.18.26.46>, #<Resolv::IPv4 104.18.27.46>]>,
|
46
|
-
"ipv6hint"=>
|
47
|
-
#<SvcbRrPatch::SvcParams::Ipv6hint:0x0000000000000004
|
48
|
-
@addresses=[#<Resolv::IPv6 2606:4700::6812:1a2e>, #<Resolv::IPv6 2606:4700::6812:1b2e>]>},
|
39
|
+
@svc_params={"alpn"=>h3,h3-29,h3-28,h3-27,h2, "ipv4hint"=>104.18.26.46,104.18.27.46, "ipv6hint"=>2606:4700::6812:1a2e,2606:4700::6812:1b2e},
|
49
40
|
@svc_priority=1,
|
50
41
|
@target_name="",
|
51
42
|
@ttl=300>]
|
@@ -15,7 +15,20 @@ class SvcbRrPatch::SvcParams::Mandatory
|
|
15
15
|
|
16
16
|
# :nodoc:
|
17
17
|
def self.decode(octet)
|
18
|
-
keys = octet.scan(/.{1,2}/)
|
18
|
+
keys = octet.scan(/.{1,2}/)
|
19
|
+
.map { |s| s.unpack1('n') }
|
20
|
+
.filter { |i| i < 7 || i >= 65280 && i < 65535 }
|
19
21
|
new(keys)
|
20
22
|
end
|
23
|
+
|
24
|
+
# :nodoc:
|
25
|
+
def inspect
|
26
|
+
@keys.map do |i|
|
27
|
+
if i < 7 || i >= 65280 && i < 65535
|
28
|
+
SvcbRrPatch::SvcParams::PARAMETER_REGISTRY[i]
|
29
|
+
else
|
30
|
+
''
|
31
|
+
end
|
32
|
+
end.join(',')
|
33
|
+
end
|
21
34
|
end
|
@@ -12,7 +12,7 @@ module SvcbRrPatch::SvcParams
|
|
12
12
|
ipv6hint
|
13
13
|
]
|
14
14
|
# rubocop:disable Security/Eval
|
15
|
-
(65280
|
15
|
+
(65280...65535).each do |nnnn|
|
16
16
|
eval "registry[nnnn] = \"key#{nnnn}\"", binding, __FILE__, __LINE__
|
17
17
|
end
|
18
18
|
# rubocop:enable Security/Eval
|
@@ -74,8 +74,8 @@ module SvcbRrPatch::SvcParams
|
|
74
74
|
# rubocop:disable Metrics/CyclomaticComplexity
|
75
75
|
def self.decode_svc_params(key, octet)
|
76
76
|
case key
|
77
|
-
when '
|
78
|
-
|
77
|
+
when 'mandatory'
|
78
|
+
Mandatory.decode(octet)
|
79
79
|
when 'alpn'
|
80
80
|
Alpn.decode(octet)
|
81
81
|
when 'no-default-alpn'
|
data/spec/alpn_spec.rb
CHANGED
data/spec/ipv4hint_spec.rb
CHANGED
@@ -5,7 +5,7 @@ require_relative 'spec_helper'
|
|
5
5
|
|
6
6
|
RSpec.describe SvcbRrPatch::SvcParams::Ipv4hint do
|
7
7
|
let(:octet) do
|
8
|
-
"\xc0\
|
8
|
+
"\xc0\x00\x02\x01\xc0\x00\x02\x02"
|
9
9
|
end
|
10
10
|
|
11
11
|
context '#decode' do
|
@@ -15,8 +15,8 @@ RSpec.describe SvcbRrPatch::SvcParams::Ipv4hint do
|
|
15
15
|
|
16
16
|
it 'could decode' do
|
17
17
|
expect(ipv4hint.addresses).to eq [
|
18
|
-
Resolv::IPv4.create('192.
|
19
|
-
Resolv::IPv4.create('192.
|
18
|
+
Resolv::IPv4.create('192.0.2.1'),
|
19
|
+
Resolv::IPv4.create('192.0.2.2')
|
20
20
|
]
|
21
21
|
end
|
22
22
|
end
|
@@ -25,14 +25,15 @@ RSpec.describe SvcbRrPatch::SvcParams::Ipv4hint do
|
|
25
25
|
let(:ipv4hint) do
|
26
26
|
SvcbRrPatch::SvcParams::Ipv4hint.new(
|
27
27
|
[
|
28
|
-
Resolv::IPv4.create('192.
|
29
|
-
Resolv::IPv4.create('192.
|
28
|
+
Resolv::IPv4.create('192.0.2.1'),
|
29
|
+
Resolv::IPv4.create('192.0.2.2')
|
30
30
|
]
|
31
31
|
)
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'could encode' do
|
35
35
|
expect(ipv4hint.encode).to eq octet
|
36
|
+
expect(ipv4hint.inspect).to eq '192.0.2.1,192.0.2.2'
|
36
37
|
end
|
37
38
|
end
|
38
39
|
end
|
data/spec/ipv6hint_spec.rb
CHANGED
@@ -5,7 +5,10 @@ require_relative 'spec_helper'
|
|
5
5
|
|
6
6
|
RSpec.describe SvcbRrPatch::SvcParams::Ipv6hint do
|
7
7
|
let(:octet) do
|
8
|
-
|
8
|
+
<<-BIN.split.map(&:hex).map(&:chr).join
|
9
|
+
20 01 0d b8 00 00 00 00 00 00 00 00 00 00 00 01
|
10
|
+
20 01 0d b8 00 00 00 00 00 00 00 00 00 00 00 02
|
11
|
+
BIN
|
9
12
|
end
|
10
13
|
|
11
14
|
context '#decode' do
|
@@ -14,20 +17,26 @@ RSpec.describe SvcbRrPatch::SvcParams::Ipv6hint do
|
|
14
17
|
end
|
15
18
|
|
16
19
|
it 'could decode' do
|
17
|
-
expect(ipv6hint.addresses)
|
18
|
-
|
20
|
+
expect(ipv6hint.addresses).to eq [
|
21
|
+
Resolv::IPv6.create('2001:db8::1'),
|
22
|
+
Resolv::IPv6.create('2001:db8::2')
|
23
|
+
]
|
19
24
|
end
|
20
25
|
end
|
21
26
|
|
22
27
|
context '#encode' do
|
23
28
|
let(:ipv6hint) do
|
24
29
|
SvcbRrPatch::SvcParams::Ipv6hint.new(
|
25
|
-
[
|
30
|
+
[
|
31
|
+
Resolv::IPv6.create('2001:db8::1'),
|
32
|
+
Resolv::IPv6.create('2001:db8::2')
|
33
|
+
]
|
26
34
|
)
|
27
35
|
end
|
28
36
|
|
29
37
|
it 'could encode' do
|
30
38
|
expect(ipv6hint.encode).to eq octet
|
39
|
+
expect(ipv6hint.inspect).to eq '2001:db8::1,2001:db8::2'
|
31
40
|
end
|
32
41
|
end
|
33
42
|
end
|
data/spec/mandatory_spec.rb
CHANGED
@@ -5,7 +5,7 @@ require_relative 'spec_helper'
|
|
5
5
|
|
6
6
|
RSpec.describe SvcbRrPatch::SvcParams::Mandatory do
|
7
7
|
let(:octet) do
|
8
|
-
"\x00\x05\xff\xa4"
|
8
|
+
"\x00\x05\x00\x06\xff\xa4"
|
9
9
|
end
|
10
10
|
|
11
11
|
let(:keys) do
|
@@ -14,7 +14,7 @@ RSpec.describe SvcbRrPatch::SvcParams::Mandatory do
|
|
14
14
|
.zip(SvcbRrPatch::SvcParams::PARAMETER_REGISTRY)
|
15
15
|
].invert
|
16
16
|
|
17
|
-
[h['ech'], h['key65444']]
|
17
|
+
[h['ech'], h['ipv6hint'], h['key65444']]
|
18
18
|
end
|
19
19
|
|
20
20
|
context '#decode' do
|
@@ -34,6 +34,7 @@ RSpec.describe SvcbRrPatch::SvcParams::Mandatory do
|
|
34
34
|
|
35
35
|
it 'could encode' do
|
36
36
|
expect(mandatory.encode).to eq octet
|
37
|
+
expect(mandatory.inspect).to eq 'ech,ipv6hint,key65444'
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
@@ -30,6 +30,7 @@ RSpec.describe SvcbRrPatch::SvcParams::NoDefaultAlpn do
|
|
30
30
|
expect(no_default_alpn)
|
31
31
|
.to be_a(SvcbRrPatch::SvcParams::NoDefaultAlpn)
|
32
32
|
expect(no_default_alpn.encode).to eq octet
|
33
|
+
expect(no_default_alpn.inspect).to eq 'h3-29,h3-28,h3-27,h2'
|
33
34
|
end
|
34
35
|
end
|
35
36
|
end
|
data/spec/port_spec.rb
CHANGED
data/spec/svc_params_spec.rb
CHANGED
@@ -8,8 +8,8 @@ RSpec.describe SvcbRrPatch::SvcParams do
|
|
8
8
|
<<-BIN.split.map(&:hex).map(&:chr).join
|
9
9
|
00 01 00 15 05 68 33 2d 32 39 05 68 33 2d 32 38
|
10
10
|
05 68 33 2d 32 37 02 68 32 00 04 00 08 c0 a8 00
|
11
|
-
01 c0 a8 00 02 00 06 00 10
|
12
|
-
|
11
|
+
01 c0 a8 00 02 00 06 00 10 20 01 0d b8 00 00 00
|
12
|
+
00 00 00 00 00 00 00 00 01 ff 35 00 03 01 02 03
|
13
13
|
BIN
|
14
14
|
end
|
15
15
|
|
@@ -28,7 +28,7 @@ RSpec.describe SvcbRrPatch::SvcParams do
|
|
28
28
|
|
29
29
|
let(:ipv6hint) do
|
30
30
|
SvcbRrPatch::SvcParams::Ipv6hint.new(
|
31
|
-
[Resolv::IPv6.create('
|
31
|
+
[Resolv::IPv6.create('2001:db8::1')]
|
32
32
|
)
|
33
33
|
end
|
34
34
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svcb_rr_patch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thekuwayama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|