123456789_123456789_123456789_123456789_123456789_

Class: Resolv::DNS::Resource::IN::ServiceBinding

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Inherits: Object
Defined in: lib/resolv.rb

Overview

Common implementation for SVCB-compatible resource records.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(priority, target, params = []) ⇒ ServiceBinding

Create a service binding resource record.

[ GitHub ]

  
# File 'lib/resolv.rb', line 2820

def initialize(priority, target, params = [])
  @priority = priority.to_int
  @target = Name.create(target)
  @params = SvcParams.new(params)
end

Class Method Details

.decode_rdata(msg)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/resolv.rb', line 2864

def self.decode_rdata(msg) # :nodoc:
  priority, = msg.get_unpack("n")
  target    = msg.get_name
  params    = SvcParams.decode(msg)
  return self.new(priority, target, params)
end

Instance Attribute Details

#alias_mode?Boolean (readonly)

Whether this RR is in AliasMode.

[ GitHub ]

  
# File 'lib/resolv.rb', line 2847

def alias_mode?
  self.priority == 0
end

#params (readonly)

The service parameters for the target host.

[ GitHub ]

  
# File 'lib/resolv.rb', line 2842

attr_reader :params

#priority (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.

[ GitHub ]

  
# File 'lib/resolv.rb', line 2832

attr_reader :priority

#service_mode?Boolean (readonly)

Whether this RR is in ServiceMode.

[ GitHub ]

  
# File 'lib/resolv.rb', line 2854

def service_mode?
  !alias_mode?
end

#target (readonly)

The domain name of the target host.

[ GitHub ]

  
# File 'lib/resolv.rb', line 2837

attr_reader :target

Instance Method Details

#encode_rdata(msg)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/resolv.rb', line 2858

def encode_rdata(msg) # :nodoc:
  msg.put_pack("n", @priority)
  msg.put_name(@target, compress: false)
  @params.encode(msg)
end