class Dnsruby::RR::IPSECKEY
Attributes
algorithm[RW]
The algorithm used by this key :
0 - no key present 1 - DSA key present 2 - RSA key present
gateway[RW]
gateway_type[RW]
Specifies the type of gateway :
0 - no gateway present 1 - 4 byte IPv4 address present 2 - 16 byte IPv6 address present 3 - wire-encoded domain name present
precedence[RW]
An 8-bit precedence for this field. Lower values are preferred.
Public Instance Methods
from_hash(hash)
click to toggle source
# File lib/dnsruby/resource/IPSECKEY.rb, line 53 def from_hash(hash) @precedence = hash[:precedence] @gateway_type = hash[:gateway_type] @algorithm = hash[:algorithm] @gateway = load_gateway_from_string(@gateway_type, hash[:gateway]) @public_key = hash[:public_key] end
from_string(input)
click to toggle source
# File lib/dnsruby/resource/IPSECKEY.rb, line 88 def from_string(input) if (input.length > 0) split = input.split(" ") @precedence = split[0].to_i @gateway_type = split[1].to_i @algorithm = split[2].to_i @gateway = load_gateway_from_string(@gateway_type, split[3]) @public_key = public_key_from_string(split[4]) end end
load_gateway_from_string(gateway_type, s)
click to toggle source
# File lib/dnsruby/resource/IPSECKEY.rb, line 61 def load_gateway_from_string(gateway_type, s) gateway = nil if (gateway_type == 0) gateway = nil elsif (gateway_type == 1) # Load IPv4 gateway gateway = IPv4.create(s) elsif (gateway_type == 2) # Load IPv6 gateway gateway = IPv6.create(s) else # Load gateway domain name gateway = Name.create(s) end return gateway end
public_key_from_string(key_text)
click to toggle source
# File lib/dnsruby/resource/IPSECKEY.rb, line 82 def public_key_from_string(key_text) key_text.gsub!(/\n/, "") key_text.gsub!(/ /, "") return key_text.unpack("m*")[0] end
public_key_string()
click to toggle source
# File lib/dnsruby/resource/IPSECKEY.rb, line 78 def public_key_string [@public_key.to_s].pack("m*").gsub("\n", "") end