packet

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package packet provides functionality for parsing and serializing DNS packets.

Package packet provides functionality for parsing and serializing DNS packets.

Package packet provides functionality for parsing and serializing DNS packets.

Package packet provides functionality for parsing and serializing DNS packets.

Index

Constants

View Source
const (
	AlgorithmRSASHA256 uint8 = 8
	AlgorithmECDSAP256 uint8 = 13
	AlgorithmED25519   uint8 = 15
)

DNSSEC Algorithm numbers per RFC 8624

View Source
const (
	// EdnsOptionNSID represents Name Server Identifier (RFC 5001).
	EdnsOptionNSID uint16 = 3
	// EdnsOptionCookie represents DNS Cookie (RFC 7873).
	EdnsOptionCookie uint16 = 10
	// EdnsOptionPadding represents EDNS0 Padding (RFC 7830).
	EdnsOptionPadding uint16 = 12
	// EdnsOptionEDE represents Extended DNS Error (RFC 8914).
	EdnsOptionEDE uint16 = 15
)

EDNS0 Option Codes

View Source
const (
	// EdeOther represents a generic error.
	EdeOther uint16 = 0
	// EdeUnsupportedDnskey indicates an unsupported DNSKEY algorithm.
	EdeUnsupportedDnskey uint16 = 1
	// EdeUnsupportedDs indicates an unsupported DS digest algorithm.
	EdeUnsupportedDs uint16 = 2
	// EdeStaleAnswer indicates the answer is stale.
	EdeStaleAnswer uint16 = 3
	// EdeForgedAnswer indicates the answer may be forged.
	EdeForgedAnswer uint16 = 4
	// EdeDnssecIndeterminate indicates DNSSEC validation is indeterminate.
	EdeDnssecIndeterminate uint16 = 5
	// EdeDnssecBogus indicates DNSSEC validation failed.
	EdeDnssecBogus uint16 = 6
	// EdeSignatureExpired indicates the RRSIG has expired.
	EdeSignatureExpired uint16 = 7
	// EdeSignatureNotYet indicates the RRSIG is not yet valid.
	EdeSignatureNotYet uint16 = 8
	// EdeMissingDnskey indicates a required DNSKEY was missing.
	EdeMissingDnskey uint16 = 9
	// EdeMissingDs indicates a required DS record was missing.
	EdeMissingDs uint16 = 10
	// EdeUnsupportedAlg indicates an unsupported DNSSEC algorithm.
	EdeUnsupportedAlg uint16 = 11
	// EdeProhibited indicates the query is prohibited.
	EdeProhibited uint16 = 18
	// EdeBlocked indicates the query was blocked by policy.
	EdeBlocked uint16 = 15
	// EdeCensored indicates the query was censored.
	EdeCensored uint16 = 16
	// EdeFiltered indicates the query was filtered.
	EdeFiltered uint16 = 17
)

RFC 8914: Extended DNS Error Codes

View Source
const (
	// OpcodeQuery represents a standard DNS query.
	OpcodeQuery uint8 = 0
	// OpcodeIQuery represents an inverse DNS query (obsolete).
	OpcodeIQuery uint8 = 1
	// OpcodeStatus represents a server status request.
	OpcodeStatus uint8 = 2
	// OpcodeNotify represents a zone change notification (RFC 1996).
	OpcodeNotify uint8 = 4
	// OpcodeUpdate represents a dynamic update request (RFC 2136).
	OpcodeUpdate uint8 = 5
)
View Source
const (
	// RcodeNoError indicates no error condition.
	RcodeNoError uint8 = 0
	// RcodeFormErr indicates a format error in the request.
	RcodeFormErr uint8 = 1
	// RcodeServFail indicates a server failure.
	RcodeServFail uint8 = 2
	// RcodeNxDomain indicates the domain name does not exist.
	RcodeNxDomain uint8 = 3
	// RcodeNotImp indicates the request is not implemented.
	RcodeNotImp uint8 = 4
	// RcodeRefused indicates the server refuses to perform the operation.
	RcodeRefused uint8 = 5
	// RcodeYxDomain indicates a name exists that should not (RFC 2136).
	RcodeYxDomain uint8 = 6
	// RcodeYxRRSet indicates an RRset exists that should not (RFC 2136).
	RcodeYxRRSet uint8 = 7
	// RcodeNxRRSet indicates an RRset does not exist that should (RFC 2136).
	RcodeNxRRSet uint8 = 8
	// RcodeNotAuth indicates the server is not authoritative for the zone.
	RcodeNotAuth uint8 = 9
	// RcodeNotZone indicates a name is not within the zone (RFC 2136).
	RcodeNotZone uint8 = 10
)
View Source
const MaxPacketSize = 65535

MaxPacketSize is the maximum size of a DNS packet over UDP (RFC 1035).

Variables

View Source
var (
	// ErrSignatureExpired indicates the signature expiration time has passed.
	ErrSignatureExpired = errors.New("dnssec: signature is expired")
	// ErrSignatureNotYetValid indicates the signature inception time has not been reached.
	ErrSignatureNotYetValid = errors.New("dnssec: signature is not yet valid")
	// ErrKeyTagMismatch indicates the RRSIG key tag doesn't match the DNSKEY.
	ErrKeyTagMismatch = errors.New("dnssec: key tag mismatch")
	// ErrAlgorithmMismatch indicates the RRSIG algorithm doesn't match the DNSKEY.
	ErrAlgorithmMismatch = errors.New("dnssec: algorithm mismatch")
	// ErrInvalidDNSKEY indicates the DNSKEY has invalid flags.
	ErrInvalidDNSKEY = errors.New("dnssec: invalid DNSKEY flags")
	// ErrLabelsMismatch indicates the RRSIG Labels field doesn't match the RRset.
	ErrLabelsMismatch = errors.New("dnssec: labels mismatch")
	// ErrInvalidSignature indicates the signature verification failed.
	ErrInvalidSignature = errors.New("dnssec: invalid signature")
	// ErrNoPublicKey indicates the DNSKEY has no public key data.
	ErrNoPublicKey = errors.New("dnssec: no public key in DNSKEY")
	// ErrUnsupportedAlgorithm indicates the algorithm is not supported.
	ErrUnsupportedAlgorithm = errors.New("dnssec: unsupported algorithm")
	// ErrNSEC3HashAlgoUnsupported indicates the NSEC3 hash algorithm is not supported.
	ErrNSEC3HashAlgoUnsupported = errors.New("dnssec: nsec3 hash algorithm unsupported")
	// ErrNSEC3InvalidProof indicates the NSEC3 proof is invalid.
	ErrNSEC3InvalidProof = errors.New("dnssec: nsec3 invalid proof")
	// ErrNSEC3ChainBroken indicates the NSEC3 hash chain is broken.
	ErrNSEC3ChainBroken = errors.New("dnssec: nsec3 chain broken")
	// ErrNSEC3NoMatchingName indicates the NSEC3 owner name doesn't match.
	ErrNSEC3NoMatchingName = errors.New("dnssec: nsec3 owner name hash mismatch")
	// ErrNSEC3NoClosestEncloser indicates no closest-encloser could be found in the NSEC3 chain.
	ErrNSEC3NoClosestEncloser = errors.New("dnssec: nsec3 no closest-encloser found")
	// ErrNSEC3NoNextCloser indicates the next-closer proof is missing or invalid.
	ErrNSEC3NoNextCloser = errors.New("dnssec: nsec3 no next-closer proof")
)

Functions

func Base32Encode

func Base32Encode(data []byte) string

Base32Encode encodes binary data into the NSEC3-specific Base32 representation.

func CanonicalWireMarshal

func CanonicalWireMarshal(r *DNSRecord, buf *BytePacketBuffer) error

CanonicalWireMarshal serializes a DNS record in canonical wire format per RFC 4034 Section 6. This format is used for DNSSEC signature verification.

func HashName

func HashName(name string, _ uint8, iterations uint16, salt []byte) []byte

HashName performs NSEC3 name hashing according to RFC 5155. It implements the iterative hashing process with salt.

func NSEC3Present

func NSEC3Present(records []DNSRecord) bool

NSEC3Present returns true if the record list contains NSEC3 records.

func PutBuffer

func PutBuffer(b *BytePacketBuffer)

PutBuffer returns a buffer to the pool.

func TypeBitMapPresent

func TypeBitMapPresent(bitmap []byte, queryType uint16) bool

TypeBitMapPresent checks if the type bitmap in an NSEC3 record indicates the presence of a given record type.

func ValidateDNSKEYFormat

func ValidateDNSKEYFormat(dnskey DNSRecord) (bool, error)

ValidateDNSKEYFormat verifies that a DNSKEY has valid structure. It checks the key tag is non-zero and the public key is parseable for the algorithm. Note: This does NOT perform cryptographic self-signature verification. For full self-signature validation, use VerifyRRSet with the DNSKEY RRset and its RRSIG.

func ValidateNSEC3Proof

func ValidateNSEC3Proof(nsec3Records []DNSRecord, queryName string, queryType uint16) error

ValidateNSEC3Proof validates NSEC3 records for an NXDOMAIN or no-data response. It implements RFC 5155 Section 7.2.1 closest-encloser + next-closer chain validation and RFC 5155 Section 7.2.14 wildcard denial proof.

For NXDOMAIN responses, the proof chain requires:

  1. A closest-encloser NSEC3 whose owner hash matches the hashed closest-encloser name
  2. A next-closer NSEC3 with a hash greater than the closest-encloser, proving no names exist between closest-encloser and query name
  3. A wildcard NSEC3 proving no wildcard exists at (closest-encloser + 1) label

For no-data responses, the NSEC3 at the exact query name hash must show the queried type bit is absent in its type bitmap. It verifies: 1. All NSEC3 records have valid format (hash algorithm = 1) 2. The NSEC3 records prove the correct response (NXDOMAIN, no-data, or wildcard) 3. Type bitmaps correctly reflect the record types present/absent

NOTE: Full NXDOMAIN validation per RFC 5155 Section 7.2.1 requires a closest-encloser proof + next-closer proof chain. This implementation only validates that at least one NSEC3 covers the query hash, which is a necessary but not sufficient condition. A complete NXDOMAIN proof requires zone-level NSEC3PARAM and sorted hash chain context.

func ValidateNSEC3RecordFormat

func ValidateNSEC3RecordFormat(nsec3 DNSRecord) error

ValidateNSEC3RecordFormat validates the wire format of an NSEC3 record. Per RFC 5155 Section 3.2, only hash algorithm 1 (SHA-1) is defined. Salt and NextHash lengths must be <= 255 bytes.

func ValidateNSEC3WildcardProof

func ValidateNSEC3WildcardProof(nsec3Records []DNSRecord, wildcardName string, queryType uint16) error

ValidateNSEC3WildcardProof verifies a wildcard proof per RFC 5155 Section 7.2.14.

This implementation is a partial check: it validates that an NSEC3 record exists whose owner name is the base32-encoded hash of wildcardName, and (optionally) that the type bitmap indicates the query type is present.

Full RFC 5155 Section 7.2.14 wildcard proof validation additionally requires: - That the immediate ancestor of the wildcard exists - That no non-wildcard records exist between wildcard and query name Implementing the complete closest-encloser / next-closer chain for wildcard proofs requires zone-level NSEC3PARAM and sorted hash chain context.

func VerifyDNSKEYMatchesDS

func VerifyDNSKEYMatchesDS(dnskey DNSRecord, ds DNSRecord) (bool, error)

VerifyDNSKEYMatchesDS verifies that a DS record matches a DNSKEY record. It recomputes the DS digest and compares it with the provided DS record.

func VerifyNSEC3OwnerName

func VerifyNSEC3OwnerName(nsec3 DNSRecord, name string) (bool, error)

VerifyNSEC3OwnerName verifies that an NSEC3 record's owner name is the correct base32-encoded hash of the given name with the NSEC3's salt and iterations.

func VerifyRRSet

func VerifyRRSet(rrset []DNSRecord, rrsig DNSRecord, dnskey DNSRecord, now uint32) (bool, error)

VerifyRRSet verifies an RRSIG signature over an RRSet. It supports ECDSA P-256 (Algorithm 13), RSA SHA-256 (Algorithm 8), and Ed25519 (Algorithm 15) signatures.

Types

type BytePacketBuffer

type BytePacketBuffer struct {
	Buf []byte
	Pos int
	Len int // High-water mark of data loaded or written

	HasNames bool // Enable/Disable name compression tracking
	// contains filtered or unexported fields
}

BytePacketBuffer simplifies reading and writing the DNS packet buffer.

func GetBuffer

func GetBuffer() *BytePacketBuffer

GetBuffer retrieves a buffer from the pool.

func NewBytePacketBuffer

func NewBytePacketBuffer() *BytePacketBuffer

NewBytePacketBuffer creates and returns a new BytePacketBuffer instance.

func (*BytePacketBuffer) Get

func (b *BytePacketBuffer) Get(pos int) (byte, error)

Get reads a byte at a specific position without moving cursor

func (*BytePacketBuffer) GetRange

func (b *BytePacketBuffer) GetRange(start int, length int) ([]byte, error)

GetRange reads a range without moving cursor

func (*BytePacketBuffer) Load

func (b *BytePacketBuffer) Load(data []byte)

Load copies the provided data into the buffer and sets its length.

func (*BytePacketBuffer) Position

func (b *BytePacketBuffer) Position() int

Position returns the current cursor position

func (*BytePacketBuffer) Read

func (b *BytePacketBuffer) Read() (byte, error)

Read reads a single byte

func (*BytePacketBuffer) ReadName

func (b *BytePacketBuffer) ReadName() (string, error)

ReadName reads a domain name, handling compression

func (*BytePacketBuffer) ReadRange

func (b *BytePacketBuffer) ReadRange(start int, length int) ([]byte, error)

ReadRange reads a slice of bytes

func (*BytePacketBuffer) Readu16

func (b *BytePacketBuffer) Readu16() (uint16, error)

Readu16 reads 2 bytes as uint16 (Big Endian)

func (*BytePacketBuffer) Readu32

func (b *BytePacketBuffer) Readu32() (uint32, error)

Readu32 reads 4 bytes as uint32 (Big Endian)

func (*BytePacketBuffer) Reset

func (b *BytePacketBuffer) Reset()

Reset clears the buffer state for reuse.

func (*BytePacketBuffer) Seek

func (b *BytePacketBuffer) Seek(pos int) error

Seek moves the cursor to a specific position

func (*BytePacketBuffer) Step

func (b *BytePacketBuffer) Step(steps int) error

Step moves the cursor forward by steps

func (*BytePacketBuffer) Write

func (b *BytePacketBuffer) Write(val byte) error

Write writes a single byte

func (*BytePacketBuffer) WriteName

func (b *BytePacketBuffer) WriteName(name string) error

WriteName writes a domain name with compression support

func (*BytePacketBuffer) WriteNameUncompressed

func (b *BytePacketBuffer) WriteNameUncompressed(name string) error

WriteNameUncompressed writes a domain name without compression

func (*BytePacketBuffer) WriteRange

func (b *BytePacketBuffer) WriteRange(start int, data []byte) error

WriteRange writes a slice of bytes at a specific position

func (*BytePacketBuffer) WriteUint8

func (b *BytePacketBuffer) WriteUint8(val int) error

WriteUint8 writes a uint8 value, constraining an int to [0,255] explicitly. This avoids G115 integer overflow warnings when converting int lengths to bytes.

func (*BytePacketBuffer) Writeu16

func (b *BytePacketBuffer) Writeu16(val uint16) error

Writeu16 writes a uint16

func (*BytePacketBuffer) Writeu32

func (b *BytePacketBuffer) Writeu32(val uint32) error

Writeu32 writes a uint32

type DNSHeader

type DNSHeader struct {
	ID                  uint16
	RecursionDesired    bool
	TruncatedMessage    bool
	AuthoritativeAnswer bool
	Opcode              uint8
	Response            bool
	ResCode             uint8 // RCODE
	CheckingDisabled    bool
	AuthedData          bool
	Z                   bool
	RecursionAvailable  bool

	// RFC 2136 (Dynamic Update) field renames:
	// Questions -> ZOCOUNT (Number of zones)
	// Answers -> PRCOUNT (Number of prerequisites)
	// AuthoritativeEntries -> UPCOUNT (Number of updates)
	// ResourceEntries -> ADCOUNT (Number of additional records)
	Questions            uint16
	Answers              uint16
	AuthoritativeEntries uint16
	ResourceEntries      uint16
}

DNSHeader represents the header section of a DNS packet.

func NewDNSHeader

func NewDNSHeader() *DNSHeader

NewDNSHeader creates and returns a pointer to a new DNSHeader.

func (*DNSHeader) Read

func (h *DNSHeader) Read(buffer *BytePacketBuffer) error

Read populates the DNSHeader fields by reading from the provided buffer.

func (*DNSHeader) Write

func (h *DNSHeader) Write(buffer *BytePacketBuffer) error

Write serializes the DNSHeader into the provided buffer.

type DNSPacket

type DNSPacket struct {
	Header      DNSHeader
	Questions   []DNSQuestion
	Answers     []DNSRecord
	Authorities []DNSRecord
	Resources   []DNSRecord
	TSIGStart   int // Byte offset where TSIG record starts, -1 if not present
}

DNSPacket represents a complete DNS packet.

func NewDNSPacket

func NewDNSPacket() *DNSPacket

NewDNSPacket creates and returns a pointer to a new DNSPacket.

func (*DNSPacket) FromBuffer

func (p *DNSPacket) FromBuffer(buffer *BytePacketBuffer) error

FromBuffer populates the DNSPacket by reading from the provided buffer.

func (*DNSPacket) SignTSIG

func (p *DNSPacket) SignTSIG(buffer *BytePacketBuffer, keyName string, secret []byte) error

SignTSIG signs the DNS packet with a TSIG record using the provided key and secret. It appends the TSIG record to the additional section and updates the packet header.

func (*DNSPacket) VerifyTSIG

func (p *DNSPacket) VerifyTSIG(rawBuffer []byte, tsigStart int, secret []byte) error

VerifyTSIG checks if the TSIG record in the packet matches the provided key and secret (RFC 2845). It validates the signature and ensures the time drift is within acceptable limits.

func (*DNSPacket) Write

func (p *DNSPacket) Write(buffer *BytePacketBuffer) error

Write serializes the complete DNSPacket into the provided buffer.

type DNSQuestion

type DNSQuestion struct {
	Name   string
	QType  QueryType
	QClass uint16
}

DNSQuestion represents a single question in the DNS question section.

func NewDNSQuestion

func NewDNSQuestion(name string, qtype QueryType) *DNSQuestion

NewDNSQuestion creates and returns a pointer to a new DNSQuestion.

func (*DNSQuestion) Read

func (q *DNSQuestion) Read(buffer *BytePacketBuffer) error

Read populates the DNSQuestion fields by reading from the provided buffer.

func (*DNSQuestion) Write

func (q *DNSQuestion) Write(buffer *BytePacketBuffer) error

Write serializes the DNSQuestion into the provided buffer.

type DNSRecord

type DNSRecord struct {
	Name     string
	Type     QueryType
	Class    uint16
	TTL      uint32
	Data     []byte
	IP       net.IP // A/AAAA
	Host     string // NS/CNAME/PTR/MD/MF/MB/MG/MR/SRV
	Priority uint16 // MX, SRV
	Weight   uint16 // SRV
	Port     uint16 // SRV
	Txt      string // TXT
	MName    string // SOA
	RName    string // SOA
	Serial   uint32 // SOA
	Refresh  uint32 // SOA
	Retry    uint32 // SOA
	Expire   uint32 // SOA
	Minimum  uint32 // SOA
	CPU      string // HINFO
	OS       string // HINFO
	Protocol uint8  // WKS
	BitMap   []byte // WKS
	RMailBX  string // MINFO
	EMailBX  string // MINFO
	// NSEC
	NextName   string
	TypeBitMap []byte
	// DNSKEY
	Flags     uint16
	Algorithm uint8
	PublicKey []byte
	// RRSIG
	TypeCovered uint16
	Labels      uint8
	OrigTTL     uint32
	Expiration  uint32
	Inception   uint32
	KeyTag      uint16
	SignerName  string
	Signature   []byte
	// NSEC3
	HashAlg    uint8
	Iterations uint16
	Salt       []byte
	NextHash   []byte
	// DS
	DigestType uint8
	Digest     []byte
	// EDNS
	UDPPayloadSize uint16
	ExtendedRcode  uint8
	EDNSVersion    uint8
	Z              uint16
	Options        []EdnsOption
	// TSIG
	AlgorithmName string
	TimeSigned    uint64
	Fudge         uint16
	MAC           []byte
	OriginalID    uint16
	Error         uint16
	Other         []byte
	// CAA
	CAAFlag  uint8
	CAATag   string
	CAAValue string
	// HTTPS (RFC 9460)
	HTTPSPriority  uint16
	HTTPSTarget    string
	HTTPSAlpn      []string
	HTTPSEchConfig []byte
	HTTPSIpv4Hint  []net.IP
	HTTPSIpv6Hint  []net.IP
	HTTPSPort      uint16
	HTTPSNoDefault bool
}

DNSRecord represents a single DNS resource record.

func FindMatchingDNSKEY

func FindMatchingDNSKEY(rrsig DNSRecord, dnskeys []DNSRecord) *DNSRecord

FindMatchingDNSKEY finds a DNSKEY that can verify an RRSIG. It matches by key tag and algorithm.

func SignRRSet

func SignRRSet(records []DNSRecord, privKey any, algorithm uint8, signerName string, keyTag uint16, inception, expiration uint32) (DNSRecord, error)

SignRRSet generates an RRSIG for a set of records. Supports ECDSA P-256 (Algorithm 13), RSA SHA-256 (Algorithm 8), and Ed25519 (Algorithm 15).

func (*DNSRecord) AddEDE

func (r *DNSRecord) AddEDE(code uint16, text string)

AddEDE adds an Extended DNS Error (RFC 8914) option to an OPT record.

func (*DNSRecord) ComputeDS

func (r *DNSRecord) ComputeDS(digestType uint8) (DNSRecord, error)

ComputeDS generates a Delegation Signer (DS) record from a DNSKEY record (RFC 4034 Section 5.2). Supported digest types:

  • 1: SHA-1
  • 2: SHA-256

func (*DNSRecord) ComputeKeyTag

func (r *DNSRecord) ComputeKeyTag() uint16

ComputeKeyTag calculates the key tag for a DNSKEY record according to RFC 4034 Appendix B. This is used to quickly identify which DNSKEY a signature refers to.

func (*DNSRecord) GetOption

func (r *DNSRecord) GetOption(code uint16) ([]byte, bool)

GetOption retrieves an EDNS option by its code.

func (*DNSRecord) Read

func (r *DNSRecord) Read(buffer *BytePacketBuffer) error

Read populates the DNSRecord fields by reading from the provided buffer.

func (*DNSRecord) SetOption

func (r *DNSRecord) SetOption(code uint16, data []byte)

SetOption adds or updates an EDNS option.

func (*DNSRecord) Write

func (r *DNSRecord) Write(buffer *BytePacketBuffer) (int, error)

Write serializes the DNSRecord into the provided buffer.

type EdnsOption

type EdnsOption struct {
	Code uint16
	Data []byte
}

EdnsOption represents a single option in an OPT pseudo-RR (RFC 6891).

type QueryType

type QueryType uint16

QueryType represents the DNS record type field (e.g., A, NS, MX).

const (
	// UNKNOWN represents an unrecognized DNS query type.
	UNKNOWN QueryType = 0
	// A represents an IPv4 address record.
	A QueryType = 1
	// NS represents an authoritative name server record.
	NS QueryType = 2
	// MD represents a mail destination record (obsolete).
	MD QueryType = 3
	// MF represents a mail forwarder record (obsolete).
	MF QueryType = 4
	// CNAME represents a canonical name for an alias.
	CNAME QueryType = 5
	// SOA represents the start of a zone of authority record.
	SOA QueryType = 6
	// MB represents a mailbox domain name record (experimental).
	MB QueryType = 7
	// MG represents a mail group member record (experimental).
	MG QueryType = 8
	// MR represents a mail rename domain name record (experimental).
	MR QueryType = 9
	// NULL represents a null RR (experimental).
	NULL QueryType = 10
	// WKS represents a well known service description record.
	WKS QueryType = 11
	// PTR represents a domain name pointer record.
	PTR QueryType = 12
	// HINFO represents host information records.
	HINFO QueryType = 13
	// MINFO represents mailbox or mail list information record.
	MINFO QueryType = 14
	// MX represents a mail exchange record.
	MX QueryType = 15
	// TXT represents text records.
	TXT QueryType = 16
	// AAAA represents an IPv6 address record.
	AAAA QueryType = 28
	// SRV represents service location records (RFC 2782).
	SRV QueryType = 33
	// DS represents a delegation signer record (RFC 4034).
	DS QueryType = 43
	// RRSIG represents a DNSSEC signature record (RFC 4034).
	RRSIG QueryType = 46
	// NSEC represents a next secure record (RFC 4034).
	NSEC QueryType = 47
	// DNSKEY represents a DNS public key record (RFC 4034).
	DNSKEY QueryType = 48
	// NSEC3 represents a next secure record version 3 (RFC 5155).
	NSEC3 QueryType = 50
	// NSEC3PARAM represents NSEC3 parameters (RFC 5155).
	NSEC3PARAM QueryType = 51
	// AXFR represents a request for a full zone transfer.
	AXFR QueryType = 252
	// IXFR represents a request for an incremental zone transfer.
	IXFR QueryType = 251
	// ANY represents a request for all records.
	ANY QueryType = 255
	// OPT represents an EDNS(0) pseudo-RR (RFC 6891).
	OPT QueryType = 41
	// TSIG represents a transaction signature record (RFC 2845).
	TSIG QueryType = 250
	// CAA represents a certification authority authorization record (RFC 6844).
	CAA QueryType = 257
	// HTTPS represents an HTTPS record (RFC 9460).
	HTTPS QueryType = 65
)

func RecordTypeToQueryType

func RecordTypeToQueryType(t domain.RecordType) QueryType

RecordTypeToQueryType converts a domain model RecordType to its corresponding packet QueryType.

func (QueryType) String

func (t QueryType) String() string

String returns the human-readable representation of a QueryType.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL