class Dnsruby::RR::SSHFP
Attributes
alg[RW]
fp[RW]
fptype[RW]
Public Instance Methods
from_hash(hash)
click to toggle source
# File lib/dnsruby/resource/SSHFP.rb, line 43 def from_hash(hash) if hash[:alg] @alg = Algorithms.new(hash[:alg]) end if hash[:fptype] @fptype = FpTypes.new(hash[:fptype]) end if hash[:fp] @fp = hash[:fp] end end
from_string(input)
click to toggle source
# File lib/dnsruby/resource/SSHFP.rb, line 55 def from_string(input) if (input.length > 0) names = input.split(" ") begin @alg = Algorithms.new(names[0].to_i) rescue ArgumentError @alg = Algorithms.new(names[0]) end begin @fptype = FpTypes.new(names[1].to_i) rescue ArgumentError @fptype = FpTypes.new(names[1]) end remaining = "" for i in 2..(names.length + 1) remaining += names[i].to_s end @fp = [remaining].pack("H*") end end
rdata_to_string()
click to toggle source
# File lib/dnsruby/resource/SSHFP.rb, line 76 def rdata_to_string ret = "#{@alg.code} #{@fptype.code} " ret += @fp.unpack("H*")[0] return ret end