dnsmessage

Imports

Imports #

"errors"

Constants & Variables

ClassANY const #

Question.Class

const ClassANY Class = 255

ClassCHAOS const #

const ClassCHAOS Class = 3

ClassCSNET const #

const ClassCSNET Class = 2

ClassHESIOD const #

const ClassHESIOD Class = 4

ClassINET const #

ResourceHeader.Class and Question.Class

const ClassINET Class = 1

ErrNotStarted var #

ErrNotStarted indicates that the prerequisite information isn't available yet because the previous records haven't been appropriately parsed, skipped or finished.

var ErrNotStarted = *ast.CallExpr

ErrSectionDone var #

ErrSectionDone indicated that all records in the section have been parsed or finished.

var ErrSectionDone = *ast.CallExpr

RCodeFormatError const #

Header.RCode values.

const RCodeFormatError RCode = 1

RCodeNameError const #

Header.RCode values.

const RCodeNameError RCode = 3

RCodeNotImplemented const #

Header.RCode values.

const RCodeNotImplemented RCode = 4

RCodeRefused const #

Header.RCode values.

const RCodeRefused RCode = 5

RCodeServerFailure const #

Header.RCode values.

const RCodeServerFailure RCode = 2

RCodeSuccess const #

Header.RCode values.

const RCodeSuccess RCode = 0

TypeA const #

ResourceHeader.Type and Question.Type

const TypeA Type = 1

TypeAAAA const #

const TypeAAAA Type = 28

TypeALL const #

const TypeALL Type = 255

TypeAXFR const #

const TypeAXFR Type = 252

TypeCNAME const #

const TypeCNAME Type = 5

TypeHINFO const #

const TypeHINFO Type = 13

TypeMINFO const #

const TypeMINFO Type = 14

TypeMX const #

const TypeMX Type = 15

TypeNS const #

const TypeNS Type = 2

TypeOPT const #

const TypeOPT Type = 41

TypePTR const #

const TypePTR Type = 12

TypeSOA const #

const TypeSOA Type = 6

TypeSRV const #

const TypeSRV Type = 33

TypeTXT const #

const TypeTXT Type = 16

TypeWKS const #

Question.Type

const TypeWKS Type = 11

classNames var #

var classNames = map[Class]string{...}

edns0DNSSECOK const #

EDNS(0) wire constants.

const edns0DNSSECOK = 0x00008000

edns0DNSSECOKMask const #

EDNS(0) wire constants.

const edns0DNSSECOKMask = 0x00ff8000

edns0Version const #

EDNS(0) wire constants.

const edns0Version = 0

ednsVersionMask const #

EDNS(0) wire constants.

const ednsVersionMask = 0x00ff0000

errBaseLen var #

var errBaseLen = *ast.CallExpr

errCalcLen var #

var errCalcLen = *ast.CallExpr

errInvalidName var #

var errInvalidName = *ast.CallExpr

errInvalidPtr var #

var errInvalidPtr = *ast.CallExpr

errNameTooLong var #

var errNameTooLong = *ast.CallExpr

errNilResouceBody var #

var errNilResouceBody = *ast.CallExpr

errNonCanonicalName var #

var errNonCanonicalName = *ast.CallExpr

errResTooLong var #

var errResTooLong = *ast.CallExpr

errReserved var #

var errReserved = *ast.CallExpr

errResourceLen var #

var errResourceLen = *ast.CallExpr

errSegTooLong var #

var errSegTooLong = *ast.CallExpr

errStringTooLong var #

var errStringTooLong = *ast.CallExpr

errTooManyAdditionals var #

var errTooManyAdditionals = *ast.CallExpr

errTooManyAnswers var #

var errTooManyAnswers = *ast.CallExpr

errTooManyAuthorities var #

var errTooManyAuthorities = *ast.CallExpr

errTooManyPtr var #

var errTooManyPtr = *ast.CallExpr

errTooManyQuestions var #

var errTooManyQuestions = *ast.CallExpr

errZeroSegLen var #

var errZeroSegLen = *ast.CallExpr

headerBitAA const #

const headerBitAA = *ast.BinaryExpr

headerBitAD const #

const headerBitAD = *ast.BinaryExpr

headerBitCD const #

const headerBitCD = *ast.BinaryExpr

headerBitQR const #

const headerBitQR = *ast.BinaryExpr

headerBitRA const #

const headerBitRA = *ast.BinaryExpr

headerBitRD const #

const headerBitRD = *ast.BinaryExpr

headerBitTC const #

const headerBitTC = *ast.BinaryExpr

headerLen const #

headerLen is the length (in bytes) of a DNS header. A header is comprised of 6 uint16s and no padding.

const headerLen = *ast.BinaryExpr

hexDigits const #

const hexDigits = "0123456789abcdef"

nonEncodedNameMax const #

const nonEncodedNameMax = 254

packStartingCap const #

packStartingCap is the default initial buffer size allocated during packing. The starting capacity doesn't matter too much, but most DNS responses Will be <= 512 bytes as it is the limit for DNS over UDP.

const packStartingCap = 512

rCodeNames var #

var rCodeNames = map[RCode]string{...}

sectionAdditionals const #

const sectionAdditionals

sectionAnswers const #

const sectionAnswers

sectionAuthorities const #

const sectionAuthorities

sectionDone const #

const sectionDone

sectionHeader const #

const sectionHeader

sectionNames var #

var sectionNames = map[section]string{...}

sectionNotStarted const #

const sectionNotStarted section = iota

sectionQuestions const #

const sectionQuestions

typeNames var #

var typeNames = map[Type]string{...}

uint16Len const #

uint16Len is the length (in bytes) of a uint16.

const uint16Len = 2

uint32Len const #

uint32Len is the length (in bytes) of a uint32.

const uint32Len = 4

Type Aliases

Class type #

A Class is a type of network.

type Class uint16

OpCode type #

An OpCode is a DNS operation code.

type OpCode uint16

RCode type #

An RCode is a DNS response status code.

type RCode uint16

Type type #

A Type is a type of DNS request and response.

type Type uint16

section type #

type section uint8

Interfaces

ResourceBody interface #

A ResourceBody is a DNS resource record minus the header.

type ResourceBody interface {
pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error)
realType() Type
GoString() string
}

Structs

AAAAResource struct #

An AAAAResource is an AAAA Resource record.

type AAAAResource struct {
AAAA [16]byte
}

AResource struct #

An AResource is an A Resource record.

type AResource struct {
A [4]byte
}

Builder struct #

A Builder allows incrementally packing a DNS message. Example usage: buf := make([]byte, 2, 514) b := NewBuilder(buf, Header{...}) b.EnableCompression() // Optionally start a section and add things to that section. // Repeat adding sections as necessary. buf, err := b.Finish() // If err is nil, buf[2:] will contain the built bytes.

type Builder struct {
msg []byte
section section
header header
start int
compression map[string]uint16
}

CNAMEResource struct #

A CNAMEResource is a CNAME Resource record.

type CNAMEResource struct {
CNAME Name
}

MXResource struct #

An MXResource is an MX Resource record.

type MXResource struct {
Pref uint16
MX Name
}

Message struct #

Message is a representation of a DNS message.

type Message struct {
Header
Questions []Question
Answers []Resource
Authorities []Resource
Additionals []Resource
}

NSResource struct #

An NSResource is an NS Resource record.

type NSResource struct {
NS Name
}

Name struct #

A Name is a non-encoded and non-escaped domain name. It is used instead of strings to avoid allocations.

type Name struct {
Data [255]byte
Length uint8
}

OPTResource struct #

An OPTResource is an OPT pseudo Resource record. The pseudo resource record is part of the extension mechanisms for DNS as defined in RFC 6891.

type OPTResource struct {
Options []Option
}

Option struct #

An Option represents a DNS message option within OPTResource. The message option is part of the extension mechanisms for DNS as defined in RFC 6891.

type Option struct {
Code uint16
Data []byte
}

PTRResource struct #

A PTRResource is a PTR Resource record.

type PTRResource struct {
PTR Name
}

Parser struct #

A Parser allows incrementally parsing a DNS message. When parsing is started, the Header is parsed. Next, each Question can be either parsed or skipped. Alternatively, all Questions can be skipped at once. When all Questions have been parsed, attempting to parse Questions will return the [ErrSectionDone] error. After all Questions have been either parsed or skipped, all Answers, Authorities and Additionals can be either parsed or skipped in the same way, and each type of Resource must be fully parsed or skipped before proceeding to the next type of Resource. Parser is safe to copy to preserve the parsing state. Note that there is no requirement to fully skip or parse the message.

type Parser struct {
msg []byte
header header
section section
off int
index int
resHeaderValid bool
resHeaderOffset int
resHeaderType Type
resHeaderLength uint16
}

Question struct #

A Question is a DNS query.

type Question struct {
Name Name
Type Type
Class Class
}

Resource struct #

A Resource is a DNS resource record.

type Resource struct {
Header ResourceHeader
Body ResourceBody
}

ResourceHeader struct #

A ResourceHeader is the header of a DNS resource record. There are many types of DNS resource records, but they all share the same header.

type ResourceHeader struct {
Name Name
Type Type
Class Class
TTL uint32
Length uint16
}

SOAResource struct #

An SOAResource is an SOA Resource record.

type SOAResource struct {
NS Name
MBox Name
Serial uint32
Refresh uint32
Retry uint32
Expire uint32
MinTTL uint32
}

SRVResource struct #

An SRVResource is an SRV Resource record.

type SRVResource struct {
Priority uint16
Weight uint16
Port uint16
Target Name
}

TXTResource struct #

A TXTResource is a TXT Resource record.

type TXTResource struct {
TXT []string
}

UnknownResource struct #

An UnknownResource is a catch-all container for unknown record types.

type UnknownResource struct {
Type Type
Data []byte
}

nestedError struct #

type nestedError struct {
s string
err error
}

Functions

AAAAResource method #

AAAAResource parses a single AAAAResource. One of the XXXHeader methods must have been called before calling this method.

func (p *Parser) AAAAResource() (AAAAResource, error)

AAAAResource method #

AAAAResource adds a single AAAAResource.

func (b *Builder) AAAAResource(h ResourceHeader, r AAAAResource) error

AResource method #

AResource parses a single AResource. One of the XXXHeader methods must have been called before calling this method.

func (p *Parser) AResource() (AResource, error)

AResource method #

AResource adds a single AResource.

func (b *Builder) AResource(h ResourceHeader, r AResource) error

Additional method #

Additional parses a single Additional Resource.

func (p *Parser) Additional() (Resource, error)

AdditionalHeader method #

AdditionalHeader parses a single Additional ResourceHeader.

func (p *Parser) AdditionalHeader() (ResourceHeader, error)

AllAdditionals method #

AllAdditionals parses all Additional Resources.

func (p *Parser) AllAdditionals() ([]Resource, error)

AllAnswers method #

AllAnswers parses all Answer Resources.

func (p *Parser) AllAnswers() ([]Resource, error)

AllAuthorities method #

AllAuthorities parses all Authority Resources.

func (p *Parser) AllAuthorities() ([]Resource, error)

AllQuestions method #

AllQuestions parses all Questions.

func (p *Parser) AllQuestions() ([]Question, error)

Answer method #

Answer parses a single Answer Resource.

func (p *Parser) Answer() (Resource, error)

AnswerHeader method #

AnswerHeader parses a single Answer ResourceHeader.

func (p *Parser) AnswerHeader() (ResourceHeader, error)

AppendPack method #

AppendPack is like Pack but appends the full Message to b and returns the extended buffer.

func (m *Message) AppendPack(b []byte) ([]byte, error)

Authority method #

Authority parses a single Authority Resource.

func (p *Parser) Authority() (Resource, error)

AuthorityHeader method #

AuthorityHeader parses a single Authority ResourceHeader.

func (p *Parser) AuthorityHeader() (ResourceHeader, error)

CNAMEResource method #

CNAMEResource adds a single CNAMEResource.

func (b *Builder) CNAMEResource(h ResourceHeader, r CNAMEResource) error

CNAMEResource method #

CNAMEResource parses a single CNAMEResource. One of the XXXHeader methods must have been called before calling this method.

func (p *Parser) CNAMEResource() (CNAMEResource, error)

DNSSECAllowed method #

DNSSECAllowed reports whether the DNSSEC OK bit is set.

func (h *ResourceHeader) DNSSECAllowed() bool

EnableCompression method #

EnableCompression enables compression in the Builder. Leaving compression disabled avoids compression related allocations, but can result in larger message sizes. Be careful with this mode as it can cause messages to exceed the UDP size limit. According to RFC 1035, section 4.1.4, the use of compression is optional, but all implementations must accept both compressed and uncompressed DNS messages. Compression should be enabled before any sections are added for best results.

func (b *Builder) EnableCompression()

Error method #

nestedError implements error.Error.

func (e *nestedError) Error() string

ExtendedRCode method #

ExtendedRCode returns an extended RCode. The provided rcode must be the RCode in DNS message header.

func (h *ResourceHeader) ExtendedRCode(rcode RCode) RCode

Finish method #

Finish ends message building and generates a binary message.

func (b *Builder) Finish() ([]byte, error)

GoString method #

GoString implements fmt.GoStringer.GoString.

func (m *Header) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (r *AAAAResource) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (t Type) GoString() string

GoString method #

func (r *Resource) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (r *UnknownResource) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (h *ResourceHeader) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (m *Message) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (n *Name) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (q *Question) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (c Class) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (r *CNAMEResource) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (r *MXResource) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (o OpCode) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (r *NSResource) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (r *OPTResource) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (r *PTRResource) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (r *SOAResource) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (r *TXTResource) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (r *SRVResource) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (r RCode) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (r *AResource) GoString() string

GoString method #

GoString implements fmt.GoStringer.GoString.

func (o *Option) GoString() string

MXResource method #

MXResource adds a single MXResource.

func (b *Builder) MXResource(h ResourceHeader, r MXResource) error

MXResource method #

MXResource parses a single MXResource. One of the XXXHeader methods must have been called before calling this method.

func (p *Parser) MXResource() (MXResource, error)

MustNewName function #

MustNewName creates a new Name from a string and panics on error.

func MustNewName(name string) Name

NSResource method #

NSResource parses a single NSResource. One of the XXXHeader methods must have been called before calling this method.

func (p *Parser) NSResource() (NSResource, error)

NSResource method #

NSResource adds a single NSResource.

func (b *Builder) NSResource(h ResourceHeader, r NSResource) error

NewBuilder function #

NewBuilder creates a new builder with compression disabled. Note: Most users will want to immediately enable compression with the EnableCompression method. See that method's comment for why you may or may not want to enable compression. The DNS message is appended to the provided initial buffer buf (which may be nil) as it is built. The final message is returned by the (*Builder).Finish method, which includes buf[:len(buf)] and may return the same underlying array if there was sufficient capacity in the slice.

func NewBuilder(buf []byte, h Header) Builder

NewName function #

NewName creates a new Name from a string.

func NewName(name string) (Name, error)

OPTResource method #

OPTResource parses a single OPTResource. One of the XXXHeader methods must have been called before calling this method.

func (p *Parser) OPTResource() (OPTResource, error)

OPTResource method #

OPTResource adds a single OPTResource.

func (b *Builder) OPTResource(h ResourceHeader, r OPTResource) error

PTRResource method #

PTRResource parses a single PTRResource. One of the XXXHeader methods must have been called before calling this method.

func (p *Parser) PTRResource() (PTRResource, error)

PTRResource method #

PTRResource adds a single PTRResource.

func (b *Builder) PTRResource(h ResourceHeader, r PTRResource) error

Pack method #

Pack packs a full Message.

func (m *Message) Pack() ([]byte, error)

Question method #

Question adds a single Question.

func (b *Builder) Question(q Question) error

Question method #

Question parses a single Question.

func (p *Parser) Question() (Question, error)

SOAResource method #

SOAResource adds a single SOAResource.

func (b *Builder) SOAResource(h ResourceHeader, r SOAResource) error

SOAResource method #

SOAResource parses a single SOAResource. One of the XXXHeader methods must have been called before calling this method.

func (p *Parser) SOAResource() (SOAResource, error)

SRVResource method #

SRVResource parses a single SRVResource. One of the XXXHeader methods must have been called before calling this method.

func (p *Parser) SRVResource() (SRVResource, error)

SRVResource method #

SRVResource adds a single SRVResource.

func (b *Builder) SRVResource(h ResourceHeader, r SRVResource) error

SetEDNS0 method #

SetEDNS0 configures h for EDNS(0). The provided extRCode must be an extended RCode.

func (h *ResourceHeader) SetEDNS0(udpPayloadLen int, extRCode RCode, dnssecOK bool) error

SkipAdditional method #

SkipAdditional skips a single Additional Resource. It does not perform a complete validation of the resource header, which means it may return a nil error when the [AdditionalHeader] would actually return an error.

func (p *Parser) SkipAdditional() error

SkipAllAdditionals method #

SkipAllAdditionals skips all Additional Resources.

func (p *Parser) SkipAllAdditionals() error

SkipAllAnswers method #

SkipAllAnswers skips all Answer Resources.

func (p *Parser) SkipAllAnswers() error

SkipAllAuthorities method #

SkipAllAuthorities skips all Authority Resources.

func (p *Parser) SkipAllAuthorities() error

SkipAllQuestions method #

SkipAllQuestions skips all Questions.

func (p *Parser) SkipAllQuestions() error

SkipAnswer method #

SkipAnswer skips a single Answer Resource. It does not perform a complete validation of the resource header, which means it may return a nil error when the [AnswerHeader] would actually return an error.

func (p *Parser) SkipAnswer() error

SkipAuthority method #

SkipAuthority skips a single Authority Resource. It does not perform a complete validation of the resource header, which means it may return a nil error when the [AuthorityHeader] would actually return an error.

func (p *Parser) SkipAuthority() error

SkipQuestion method #

SkipQuestion skips a single Question.

func (p *Parser) SkipQuestion() error

Start method #

Start parses the header and enables the parsing of Questions.

func (p *Parser) Start(msg []byte) (Header, error)

StartAdditionals method #

StartAdditionals prepares the builder for packing Additionals.

func (b *Builder) StartAdditionals() error

StartAnswers method #

StartAnswers prepares the builder for packing Answers.

func (b *Builder) StartAnswers() error

StartAuthorities method #

StartAuthorities prepares the builder for packing Authorities.

func (b *Builder) StartAuthorities() error

StartQuestions method #

StartQuestions prepares the builder for packing Questions.

func (b *Builder) StartQuestions() error

String method #

String implements fmt.Stringer.String.

func (c Class) String() string

String method #

String implements fmt.Stringer.String.

func (r RCode) String() string

String method #

String implements fmt.Stringer.String.

func (t Type) String() string

String method #

String implements fmt.Stringer.String. Note: characters inside the labels are not escaped in any way.

func (n Name) String() string

TXTResource method #

TXTResource parses a single TXTResource. One of the XXXHeader methods must have been called before calling this method.

func (p *Parser) TXTResource() (TXTResource, error)

TXTResource method #

TXTResource adds a single TXTResource.

func (b *Builder) TXTResource(h ResourceHeader, r TXTResource) error

UnknownResource method #

UnknownResource parses a single UnknownResource. One of the XXXHeader methods must have been called before calling this method.

func (p *Parser) UnknownResource() (UnknownResource, error)

UnknownResource method #

UnknownResource adds a single UnknownResource.

func (b *Builder) UnknownResource(h ResourceHeader, r UnknownResource) error

Unpack method #

Unpack parses a full Message.

func (m *Message) Unpack(msg []byte) error

checkAdvance method #

func (p *Parser) checkAdvance(sec section) error

checkResourceSection method #

func (b *Builder) checkResourceSection() error

count method #

func (h *header) count(sec section) uint16

fixLen method #

fixLen updates a packed ResourceHeader to include the length of the ResourceBody. lenOff is the offset of the ResourceHeader.Length field in msg. preLen is the length that msg was before the ResourceBody was packed.

func (h *ResourceHeader) fixLen(msg []byte, lenOff int, preLen int) error

incrementSectionCount method #

func (b *Builder) incrementSectionCount() error

pack method #

pack appends the wire format of the AAAAResource to msg.

func (r *AAAAResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error)

pack method #

pack appends the wire format of the TXTResource to msg.

func (r *TXTResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error)

pack method #

pack appends the wire format of the header to msg.

func (h *header) pack(msg []byte) []byte

pack method #

pack appends the wire format of the AResource to msg.

func (r *AResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error)

pack method #

pack appends the wire format of the MXResource to msg.

func (r *MXResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error)

pack method #

pack appends the wire format of the Question to msg.

func (q *Question) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error)

pack method #

pack appends the wire format of the SRVResource to msg.

func (r *SRVResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error)

pack method #

pack appends the wire format of the UnknownResource to msg.

func (r *UnknownResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error)

pack method #

pack appends the wire format of the CNAMEResource to msg.

func (r *CNAMEResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error)

pack method #

pack appends the wire format of the Resource to msg.

func (r *Resource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error)

pack method #

pack appends the wire format of the NSResource to msg.

func (r *NSResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error)

pack method #

pack appends the wire format of the SOAResource to msg.

func (r *SOAResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error)

pack method #

pack appends the wire format of the Name to msg. Domain names are a sequence of counted strings split at the dots. They end with a zero-length string. Compression can be used to reuse domain suffixes. The compression map will be updated with new domain suffixes. If compression is nil, compression will not be used.

func (n *Name) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error)

pack method #

pack appends the wire format of the ResourceHeader to oldMsg. lenOff is the offset in msg where the Length field was packed.

func (h *ResourceHeader) pack(oldMsg []byte, compression map[string]uint16, compressionOff int) (msg []byte, lenOff int, err error)

pack method #

pack appends the wire format of the PTRResource to msg.

func (r *PTRResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error)

pack method #

func (r *OPTResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error)

pack method #

func (m *Header) pack() (id uint16, bits uint16)

packBytes function #

packBytes appends the wire format of field to msg.

func packBytes(msg []byte, field []byte) []byte

packClass function #

packClass appends the wire format of field to msg.

func packClass(msg []byte, field Class) []byte

packText function #

packText appends the wire format of field to msg.

func packText(msg []byte, field string) ([]byte, error)

packType function #

packType appends the wire format of field to msg.

func packType(msg []byte, field Type) []byte

packUint16 function #

packUint16 appends the wire format of field to msg.

func packUint16(msg []byte, field uint16) []byte

packUint32 function #

packUint32 appends the wire format of field to msg.

func packUint32(msg []byte, field uint32) []byte

printBool function #

func printBool(b bool) string

printByteSlice function #

func printByteSlice(b []byte) string

printPaddedUint8 function #

func printPaddedUint8(i uint8) string

printString function #

func printString(str []byte) string

printUint16 function #

func printUint16(i uint16) string

printUint32 function #

func printUint32(i uint32) string

printUint8Bytes function #

func printUint8Bytes(buf []byte, i uint8) []byte

realType method #

func (r *CNAMEResource) realType() Type

realType method #

func (r *AResource) realType() Type

realType method #

func (r *OPTResource) realType() Type

realType method #

func (r *TXTResource) realType() Type

realType method #

func (r *SOAResource) realType() Type

realType method #

func (r *NSResource) realType() Type

realType method #

func (r *SRVResource) realType() Type

realType method #

func (r *UnknownResource) realType() Type

realType method #

func (r *AAAAResource) realType() Type

realType method #

func (r *PTRResource) realType() Type

realType method #

func (r *MXResource) realType() Type

resource method #

func (p *Parser) resource(sec section) (Resource, error)

resourceHeader method #

func (p *Parser) resourceHeader(sec section) (ResourceHeader, error)

skipClass function #

func skipClass(msg []byte, off int) (int, error)

skipName function #

func skipName(msg []byte, off int) (int, error)

skipResource function #

func skipResource(msg []byte, off int) (int, error)

skipResource method #

func (p *Parser) skipResource(sec section) error

skipType function #

func skipType(msg []byte, off int) (int, error)

skipUint16 function #

func skipUint16(msg []byte, off int) (int, error)

skipUint32 function #

func skipUint32(msg []byte, off int) (int, error)

startCheck method #

func (b *Builder) startCheck(s section) error

unpack method #

func (h *header) unpack(msg []byte, off int) (int, error)

unpack method #

unpack unpacks a domain name.

func (n *Name) unpack(msg []byte, off int) (int, error)

unpack method #

func (h *ResourceHeader) unpack(msg []byte, off int) (int, error)

unpackAAAAResource function #

func unpackAAAAResource(msg []byte, off int) (AAAAResource, error)

unpackAResource function #

func unpackAResource(msg []byte, off int) (AResource, error)

unpackBytes function #

func unpackBytes(msg []byte, off int, field []byte) (int, error)

unpackCNAMEResource function #

func unpackCNAMEResource(msg []byte, off int) (CNAMEResource, error)

unpackClass function #

func unpackClass(msg []byte, off int) (Class, int, error)

unpackMXResource function #

func unpackMXResource(msg []byte, off int) (MXResource, error)

unpackNSResource function #

func unpackNSResource(msg []byte, off int) (NSResource, error)

unpackOPTResource function #

func unpackOPTResource(msg []byte, off int, length uint16) (OPTResource, error)

unpackPTRResource function #

func unpackPTRResource(msg []byte, off int) (PTRResource, error)

unpackResourceBody function #

func unpackResourceBody(msg []byte, off int, hdr ResourceHeader) (ResourceBody, int, error)

unpackSOAResource function #

func unpackSOAResource(msg []byte, off int) (SOAResource, error)

unpackSRVResource function #

func unpackSRVResource(msg []byte, off int) (SRVResource, error)

unpackTXTResource function #

func unpackTXTResource(msg []byte, off int, length uint16) (TXTResource, error)

unpackText function #

func unpackText(msg []byte, off int) (string, int, error)

unpackType function #

func unpackType(msg []byte, off int) (Type, int, error)

unpackUint16 function #

func unpackUint16(msg []byte, off int) (uint16, int, error)

unpackUint32 function #

func unpackUint32(msg []byte, off int) (uint32, int, error)

unpackUnknownResource function #

func unpackUnknownResource(recordType Type, msg []byte, off int, length uint16) (UnknownResource, error)

Generated with Arrow