Class: DNS::Zone::RR::SSHFP

Inherits:
Record
  • Object
show all
Defined in:
lib/dns/zone/rr/sshfp.rb

Overview

`SSHFP` resource record.

RFC 4255

Constant Summary collapse

REGEX_SSHFP_RDATA =
%r{
  (?<algorithm_number>\d+)\s*
  (?<fingerprint_type>\d+)\s*
  (?<fingerprint>#{DNS::Zone::RR::REGEX_STRING})\s*
}mx

Instance Attribute Summary collapse

Attributes inherited from Record

#klass, #label, #ttl

Instance Method Summary collapse

Methods inherited from Record

#general_prefix, #initialize, #load_general_and_get_rdata, #type

Constructor Details

This class inherits a constructor from DNS::Zone::RR::Record

Instance Attribute Details

#algorithm_numberObject

Returns the value of attribute algorithm_number


12
13
14
# File 'lib/dns/zone/rr/sshfp.rb', line 12

def algorithm_number
  @algorithm_number
end

#fingerprintObject

Returns the value of attribute fingerprint


12
13
14
# File 'lib/dns/zone/rr/sshfp.rb', line 12

def fingerprint
  @fingerprint
end

#fingerprint_typeObject

Returns the value of attribute fingerprint_type


12
13
14
# File 'lib/dns/zone/rr/sshfp.rb', line 12

def fingerprint_type
  @fingerprint_type
end

Instance Method Details

#dumpObject


14
15
16
17
18
19
20
# File 'lib/dns/zone/rr/sshfp.rb', line 14

def dump
  parts = general_prefix
  parts << algorithm_number
  parts << fingerprint_type
  parts << fingerprint
  parts.join(' ')
end

#load(string, options = {}) ⇒ Object


22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/dns/zone/rr/sshfp.rb', line 22

def load(string, options = {})
  rdata = load_general_and_get_rdata(string, options)
  return nil unless rdata

  captures = rdata.match(REGEX_SSHFP_RDATA)
  return nil unless captures

  @algorithm_number = captures[:algorithm_number].to_i
  @fingerprint_type = captures[:fingerprint_type].to_i
  @fingerprint = captures[:fingerprint]
  self
end