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

Inherits:
Resource
  • Object
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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flags, tag, value) ⇒ CAA

Creates a new CAA for flags, tag and value.



2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
# File 'lib/resolv.rb', line 2683

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


2700
2701
2702
# File 'lib/resolv.rb', line 2700

def flags
  @flags
end

#tagObject (readonly)

Property tag ("issue", "issuewild", "iodef"...).



2705
2706
2707
# File 'lib/resolv.rb', line 2705

def tag
  @tag
end

#valueObject (readonly)

Property value.



2710
2711
2712
# File 'lib/resolv.rb', line 2710

def value
  @value
end

Class Method Details

.decode_rdata(msg) ⇒ Object

:nodoc:



2725
2726
2727
2728
2729
2730
# File 'lib/resolv.rb', line 2725

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)


2715
2716
2717
# File 'lib/resolv.rb', line 2715

def critical?
  flags & 0x80 != 0
end

#encode_rdata(msg) ⇒ Object

:nodoc:



2719
2720
2721
2722
2723
# File 'lib/resolv.rb', line 2719

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