Class: Resolv::DNS::Resource::IN::ServiceBinding
- Inherits:
-
Object
- Object
- Resolv::DNS::Resource::IN::ServiceBinding
- Defined in:
- lib/resolv.rb
Overview
Common implementation for SVCB-compatible resource records.
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
The service parameters for the target host.
-
#priority ⇒ Object
readonly
The priority of this target host.
-
#target ⇒ Object
readonly
The domain name of the target host.
Class Method Summary collapse
-
.decode_rdata(msg) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#alias_mode? ⇒ Boolean
Whether this RR is in AliasMode.
-
#encode_rdata(msg) ⇒ Object
:nodoc:.
-
#initialize(priority, target, params = []) ⇒ ServiceBinding
constructor
Create a service binding resource record.
-
#service_mode? ⇒ Boolean
Whether this RR is in ServiceMode.
Constructor Details
#initialize(priority, target, params = []) ⇒ ServiceBinding
Create a service binding resource record.
2940 2941 2942 2943 2944 |
# File 'lib/resolv.rb', line 2940 def initialize(priority, target, params = []) @priority = priority.to_int @target = Name.create(target) @params = SvcParams.new(params) end |
Instance Attribute Details
#params ⇒ Object (readonly)
The service parameters for the target host.
2962 2963 2964 |
# File 'lib/resolv.rb', line 2962 def params @params end |
#priority ⇒ Object (readonly)
The priority of this target host.
The range is 0-65535. If set to 0, this RR is in AliasMode. Otherwise, it is in ServiceMode.
2952 2953 2954 |
# File 'lib/resolv.rb', line 2952 def priority @priority end |
#target ⇒ Object (readonly)
The domain name of the target host.
2957 2958 2959 |
# File 'lib/resolv.rb', line 2957 def target @target end |
Class Method Details
Instance Method Details
#alias_mode? ⇒ Boolean
Whether this RR is in AliasMode.
2967 2968 2969 |
# File 'lib/resolv.rb', line 2967 def alias_mode? self.priority == 0 end |
#encode_rdata(msg) ⇒ Object
:nodoc:
2978 2979 2980 2981 2982 |
# File 'lib/resolv.rb', line 2978 def encode_rdata(msg) # :nodoc: msg.put_pack("n", @priority) msg.put_name(@target, compress: false) @params.encode(msg) end |
#service_mode? ⇒ Boolean
Whether this RR is in ServiceMode.
2974 2975 2976 |
# File 'lib/resolv.rb', line 2974 def service_mode? !alias_mode? end |