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.



2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
# File 'lib/resolv.rb', line 2563

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 proprty:

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



2580
2581
2582
# File 'lib/resolv.rb', line 2580

def flags
  @flags
end

#tagObject (readonly)

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



2585
2586
2587
# File 'lib/resolv.rb', line 2585

def tag
  @tag
end

#valueObject (readonly)

Property value.



2590
2591
2592
# File 'lib/resolv.rb', line 2590

def value
  @value
end

Class Method Details

.decode_rdata(msg) ⇒ Object

:nodoc:



2605
2606
2607
2608
2609
2610
# File 'lib/resolv.rb', line 2605

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)


2595
2596
2597
# File 'lib/resolv.rb', line 2595

def critical?
  flags & 0x80 != 0
end

#encode_rdata(msg) ⇒ Object

:nodoc:



2599
2600
2601
2602
2603
# File 'lib/resolv.rb', line 2599

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