Class: SvcbRrPatch::SvcParams::Ech
- Inherits:
-
Object
- Object
- SvcbRrPatch::SvcParams::Ech
- Defined in:
- lib/svcb_rr_patch/svc_params/ech.rb
Instance Attribute Summary collapse
-
#echconfiglist ⇒ Object
readonly
Returns the value of attribute echconfiglist.
Class Method Summary collapse
-
.decode(octet) ⇒ Object
:nodoc:.
Instance Method Summary collapse
- #encode ⇒ String
-
#initialize(echconfiglist) ⇒ Ech
constructor
A new instance of Ech.
-
#to_s ⇒ Object
www.ietf.org/archive/id/draft-ietf-dnsop-svcb-https-06.html#section-9 In presentation format, the value is a single ECHConfigList encoded in Base64.
Constructor Details
#initialize(echconfiglist) ⇒ Ech
7 8 9 |
# File 'lib/svcb_rr_patch/svc_params/ech.rb', line 7 def initialize(echconfiglist) @echconfiglist = echconfiglist end |
Instance Attribute Details
#echconfiglist ⇒ Object (readonly)
Returns the value of attribute echconfiglist.
4 5 6 |
# File 'lib/svcb_rr_patch/svc_params/ech.rb', line 4 def echconfiglist @echconfiglist end |
Class Method Details
.decode(octet) ⇒ Object
:nodoc:
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/svcb_rr_patch/svc_params/ech.rb', line 17 def self.decode(octet) raise ::Resolv::DNS::DecodeError \ unless octet.length == octet.slice(0, 2).unpack1('n') + 2 begin echconfiglist = ::ECHConfig.decode_vectors(octet.slice(2..)) rescue ::ECHConfig::Error raise ::Resolv::DNS::DecodeError end new(echconfiglist) end |
Instance Method Details
#encode ⇒ String
12 13 14 |
# File 'lib/svcb_rr_patch/svc_params/ech.rb', line 12 def encode @echconfiglist.map(&:encode).join.then { |s| [s.length].pack('n') + s } end |
#to_s ⇒ Object
www.ietf.org/archive/id/draft-ietf-dnsop-svcb-https-06.html#section-9 In presentation format, the value is a single ECHConfigList encoded in Base64.
33 34 35 |
# File 'lib/svcb_rr_patch/svc_params/ech.rb', line 33 def to_s Base64.strict_encode64(encode) end |