Class: Resolv::DNS::Resource::CAA

Inherits:
Resolv::DNS::Resource show all
Defined in:
lib/resolv.rb

Overview

CAA resource record defined in RFC 8659

These records identify certificate authority allowed to issue certificates for the given domain.

Constant Summary collapse

TypeValue =
257

Constants inherited from Resolv::DNS::Resource

ClassHash, ClassInsensitiveTypes, ClassValue

Instance Attribute Summary collapse

Attributes inherited from Resolv::DNS::Resource

#ttl

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resolv::DNS::Resource

#==, #eql?, get_class, #hash

Constructor Details

#initialize(flags, tag, value) ⇒ CAA

Creates a new CAA for flags, tag and value.



2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
# File 'lib/resolv.rb', line 2594

def initialize(flags, tag, value)
  unless (0..255) === flags
    raise ArgumentError.new('flags must be an Integer between 0 and 255')
  end
  unless (1..15) === tag.bytesize
    raise ArgumentError.new('length of tag must be between 1 and 15')
  end

  @flags = flags
  @tag = tag
  @value = value
end

Instance Attribute Details

#flagsObject (readonly)

Flags for this property:

  • Bit 0 : 0 = not critical, 1 = critical



2611
2612
2613
# File 'lib/resolv.rb', line 2611

def flags
  @flags
end

#tagObject (readonly)

Property tag (“issue”, “issuewild”, “iodef”…).



2616
2617
2618
# File 'lib/resolv.rb', line 2616

def tag
  @tag
end

#valueObject (readonly)

Property value.



2621
2622
2623
# File 'lib/resolv.rb', line 2621

def value
  @value
end

Class Method Details

.decode_rdata(msg) ⇒ Object

:nodoc:



2636
2637
2638
2639
2640
2641
# File 'lib/resolv.rb', line 2636

def self.decode_rdata(msg) # :nodoc:
  flags, = msg.get_unpack('C')
  tag = msg.get_string
  value = msg.get_bytes
  self.new flags, tag, value
end

Instance Method Details

#critical?Boolean

Whether the critical flag is set on this property.

Returns:

  • (Boolean)


2626
2627
2628
# File 'lib/resolv.rb', line 2626

def critical?
  flags & 0x80 != 0
end

#encode_rdata(msg) ⇒ Object

:nodoc:



2630
2631
2632
2633
2634
# File 'lib/resolv.rb', line 2630

def encode_rdata(msg) # :nodoc:
  msg.put_pack('C', @flags)
  msg.put_string(@tag)
  msg.put_bytes(@value)
end