Class: Resolv::DNS::Resource::IN::SVCB
- Inherits:
-
Resolv::DNS::Resource
- Object
- Resolv::DNS::Resource
- Resolv::DNS::Resource::IN::SVCB
- Defined in:
- lib/svcb_rr_patch/svcb.rb
Overview
The SVCB(contraction of “service binding”) DNS Resource Record
Direct Known Subclasses
Constant Summary collapse
- TypeValue =
rubocop: disable Naming/ConstantName
64- ClassValue =
IN::ClassValue
Instance Attribute Summary collapse
-
#svc_params ⇒ Object
readonly
SvcPriority.
-
#svc_priority ⇒ Object
readonly
SvcPriority.
-
#target_name ⇒ Object
readonly
SvcPriority.
Class Method Summary collapse
-
.decode_rdata(msg) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#encode_rdata(msg) ⇒ Object
:nodoc:.
-
#initialize(svc_priority, target_name, svc_params) ⇒ SVCB
constructor
rubocop: disable Lint/MissingSuper.
Constructor Details
#initialize(svc_priority, target_name, svc_params) ⇒ SVCB
rubocop: disable Lint/MissingSuper
15 16 17 18 19 20 |
# File 'lib/svcb_rr_patch/svcb.rb', line 15 def initialize(svc_priority, target_name, svc_params) # https://www.ietf.org/archive/id/draft-ietf-dnsop-svcb-https-06.html @svc_priority = svc_priority @target_name = target_name @svc_params = svc_params end |
Instance Attribute Details
#svc_params ⇒ Object (readonly)
SvcPriority
26 27 28 |
# File 'lib/svcb_rr_patch/svcb.rb', line 26 def svc_params @svc_params end |
#svc_priority ⇒ Object (readonly)
SvcPriority
26 27 28 |
# File 'lib/svcb_rr_patch/svcb.rb', line 26 def svc_priority @svc_priority end |
#target_name ⇒ Object (readonly)
SvcPriority
26 27 28 |
# File 'lib/svcb_rr_patch/svcb.rb', line 26 def target_name @target_name end |
Class Method Details
.decode_rdata(msg) ⇒ Object
:nodoc:
43 44 45 46 47 48 49 50 51 |
# File 'lib/svcb_rr_patch/svcb.rb', line 43 def decode_rdata(msg) svc_priority = msg.get_bytes(2).unpack1('n') target_name = msg.get_string return new(svc_priority, target_name, {}) if svc_priority.zero? # the SvcParams, consuming the remainder of the record svc_params = ::SvcbRrPatch::SvcParams::Hash.decode(msg.get_bytes) new(svc_priority, target_name, svc_params) end |
Instance Method Details
#encode_rdata(msg) ⇒ Object
:nodoc:
35 36 37 38 39 |
# File 'lib/svcb_rr_patch/svcb.rb', line 35 def encode_rdata(msg) msg.put_bytes([@svc_priority].pack('n')) msg.put_string(@target_name) msg.put_string(@svc_params.encode) end |