Parent

Class Index [+]

Quicksearch

Dnsruby::RR::IN::SRV

SRV resource record defined in RFC 2782

These records identify the hostname and port that a service is available at.

The format is:

  _Service._Proto.Name TTL Class SRV Priority Weight Port Target

The fields specific to SRV are defined in RFC 2782

Attributes

priority[RW]

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.

weight[RW]

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.

port[RW]

The port on this target host of this service. The range is 0-65535.

target[RW]

The domain name of the target host. A target of “.” means that the service is decidedly not available at this domain.

Public Instance Methods

from_hash(hash) click to toggle source
    # File lib/Dnsruby/resource/SRV.rb, line 60
60:         def from_hash(hash)
61:           if hash[:priority]
62:             @priority = hash[:priority].to_int
63:           end
64:           if hash[:weight]
65:             @weight = hash[:weight].to_int
66:           end
67:           if hash[:port]
68:             @port = hash[:port].to_int
69:           end
70:           if hash[:target]
71:             @target= Name.create(hash[:target])
72:           end
73:         end
from_string(input) click to toggle source
    # File lib/Dnsruby/resource/SRV.rb, line 75
75:         def from_string(input)
76:           if (input.length > 0)
77:             names = input.split(" ")
78:             @priority = names[0].to_i
79:             @weight = names[1].to_i
80:             @port = names[2].to_i
81:             if (names[3])
82:               @target = Name.create(names[3])
83:             end
84:           end
85:         end
rdata_to_string() click to toggle source
    # File lib/Dnsruby/resource/SRV.rb, line 87
87:         def rdata_to_string
88:           if (@target!=nil)
89:             return "#{@priority} #{@weight} #{@port} #{@target.to_s(true)}"
90:           else
91:             return ""
92:           end
93:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.