Class: Gem::Resolv::DNS::Resource::IN::SRV
- Inherits:
-
Gem::Resolv::DNS::Resource
- Object
- Query
- Gem::Resolv::DNS::Resource
- Gem::Resolv::DNS::Resource::IN::SRV
- Defined in:
- lib/rubygems/vendor/resolv/lib/resolv.rb
Overview
SRV resource record defined in RFC 2782
These records identify the hostname and port that a service is available at.
Constant Summary collapse
- TypeValue =
33
- ClassValue =
IN::ClassValue
Constants inherited from Gem::Resolv::DNS::Resource
ClassHash, ClassInsensitiveTypes
Instance Attribute Summary collapse
-
#port ⇒ Object
readonly
The port on this target host of this service.
-
#priority ⇒ Object
readonly
The priority of this target host.
-
#target ⇒ Object
readonly
The domain name of the target host.
-
#weight ⇒ Object
readonly
A server selection mechanism.
Attributes inherited from Gem::Resolv::DNS::Resource
Class Method Summary collapse
-
.decode_rdata(msg) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#encode_rdata(msg) ⇒ Object
:nodoc:.
-
#initialize(priority, weight, port, target) ⇒ SRV
constructor
Create a SRV resource record.
Methods inherited from Gem::Resolv::DNS::Resource
Constructor Details
#initialize(priority, weight, port, target) ⇒ SRV
Create a SRV resource record.
See the documentation for #priority, #weight, #port and #target for priority
, weight
, +port and target
respectively.
2688 2689 2690 2691 2692 2693 |
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2688 def initialize(priority, weight, port, target) @priority = priority.to_int @weight = weight.to_int @port = port.to_int @target = Name.create(target) end |
Instance Attribute Details
#port ⇒ Object (readonly)
The port on this target host of this service.
The range is 0-65535.
2721 2722 2723 |
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2721 def port @port end |
#priority ⇒ Object (readonly)
The priority of this target host.
A client MUST attempt to contact the target host with the lowest-numbered priority it can reach; target hosts with the same priority SHOULD be tried in an order defined by the weight field. The range is 0-65535. Note that it is not widely implemented and should be set to zero.
2703 2704 2705 |
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2703 def priority @priority end |
#target ⇒ Object (readonly)
The domain name of the target host.
A target of “.” means that the service is decidedly not available at this domain.
2728 2729 2730 |
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2728 def target @target end |
#weight ⇒ Object (readonly)
A server selection mechanism.
The weight field specifies a relative weight for entries with the same priority. Larger weights SHOULD be given a proportionately higher probability of being selected. The range of this number is 0-65535. Domain administrators SHOULD use Weight 0 when there isn’t any server selection to do, to make the RR easier to read for humans (less noisy). Note that it is not widely implemented and should be set to zero.
2715 2716 2717 |
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2715 def weight @weight end |
Class Method Details
.decode_rdata(msg) ⇒ Object
:nodoc:
2737 2738 2739 2740 2741 2742 2743 |
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2737 def self.decode_rdata(msg) # :nodoc: priority, = msg.get_unpack("n") weight, = msg.get_unpack("n") port, = msg.get_unpack("n") target = msg.get_name return self.new(priority, weight, port, target) end |
Instance Method Details
#encode_rdata(msg) ⇒ Object
:nodoc:
2730 2731 2732 2733 2734 2735 |
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2730 def encode_rdata(msg) # :nodoc: msg.put_pack("n", @priority) msg.put_pack("n", @weight) msg.put_pack("n", @port) msg.put_name(@target, compress: false) end |