Documentation
¶
Index ¶
- Variables
- type DefaultPacker
- func (p *DefaultPacker) Pack(message *dns.Message) ([]byte, error)
- func (p *DefaultPacker) PackHeader(header dns.Header, buf []byte, offset int) (int, error)
- func (p *DefaultPacker) PackQuestion(question dns.Question, buf []byte, offset int) (int, error)
- func (p *DefaultPacker) PackRR(rr rr.RR, buf []byte, offset int) (int, error)
- func (p *DefaultPacker) PackRRHeader(header *rr.Header, buf []byte, offset int) (int, error)
- func (p *DefaultPacker) PackRRList(rrs []rr.RR, buf []byte, offset int) (int, error)
- type DefaultUnpacker
- func (p *DefaultUnpacker) Unpack(header dns.Header, data []byte, offset int) (*dns.Message, error)
- func (p *DefaultUnpacker) UnpackHeader(data []byte) (dns.Header, int, error)
- func (p *DefaultUnpacker) UnpackQuestion(data []byte, offset int) (dns.Question, int, error)
- func (p *DefaultUnpacker) UnpackRR(data []byte, offset int) (rr.RR, int, error)
- func (p *DefaultUnpacker) UnpackRRHeader(data []byte, offset int) (rr.Header, int, error)
- func (p *DefaultUnpacker) UnpackRRList(count uint16, data []byte, offset int) ([]rr.RR, int, error)
- type Packer
- type Unpacker
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoBody = errors.New("no body data") ErrUnpackpingQName = errors.New("error while unpacking QNAME") )
Functions ¶
This section is empty.
Types ¶
type DefaultPacker ¶
type DefaultPacker struct { }
DefaultPacker is the default packer implementation which follows the specs RFC 1034 and 1035
func (*DefaultPacker) Pack ¶
func (p *DefaultPacker) Pack(message *dns.Message) ([]byte, error)
Packs packs a single DNS message by converting the provided message to the wire format
func (*DefaultPacker) PackHeader ¶
PackHeader packs header data by converting the provided header to the wire format
func (*DefaultPacker) PackQuestion ¶
PackQuestion packs a question by converting the provided question to the wire format
func (*DefaultPacker) PackRR ¶
PackRR packs a single resource record by converting the provided data to the wire format
func (*DefaultPacker) PackRRHeader ¶
PackRRHeader packs a resource record header by converting the provided data to the wire format
func (*DefaultPacker) PackRRList ¶
PackRRList packs a slice of resource records by converting the provided records to the wire format
type DefaultUnpacker ¶
type DefaultUnpacker struct {
// contains filtered or unexported fields
}
DefaultWrapper describes the default wrapper to unwrap / wrap DNS messages. It is based on a regular byte Reader to read bytes into a pre-defined struct
func (*DefaultUnpacker) Unpack ¶
Unpack unpacks a single complete DNS message from the received byte slice
func (*DefaultUnpacker) UnpackHeader ¶
UnpackHeader unpacks header data from the received byte slice
func (*DefaultUnpacker) UnpackQuestion ¶
UnpackQuestion unpacks a question from the received byte slice
func (*DefaultUnpacker) UnpackRR ¶
UnpackRR unpacks a single resource record from the received byte slice
func (*DefaultUnpacker) UnpackRRHeader ¶
UnpackRRHeader unpacks header data of a resource record from the received byte slice
func (*DefaultUnpacker) UnpackRRList ¶
UnpackRRList unpacks a list of resource records from the received byte slice
type Packer ¶
type Packer interface { // Packs packs a single DNS message by converting // the provided message to the wire format Pack(*dns.Message) ([]byte, error) // PackHeader packs header data by converting // the provided header to the wire format PackHeader(dns.Header, []byte, int) (int, error) // PackQuestion packs a question by converting // the provided question to the wire format PackQuestion(dns.Question, []byte, int) (int, error) // PackRRList packs a slice of resource records // by converting the provided records to the // wire format PackRRList([]rr.RR, []byte, int) (int, error) // PackRR packs a single resource record by // converting the provided data to the wire // format PackRR(rr.RR, []byte, int) (int, error) // PackRRHeader packs a resource record header // by converting the provided data to the // wire format PackRRHeader(*rr.Header, []byte, int) (int, error) }
Packer packs DNS messages from a struct into the wire format
func NewDefaultPacker ¶
func NewDefaultPacker() Packer
type Unpacker ¶
type Unpacker interface { // Unpack unpacks a single complete DNS message from the // received byte slice Unpack(dns.Header, []byte, int) (*dns.Message, error) // UnpackHeader unpacks header data from the received // byte slice UnpackHeader([]byte) (dns.Header, int, error) // UnpackQuestion unpacks a question from the received // byte slice UnpackQuestion([]byte, int) (dns.Question, int, error) // UnpackRRList unpacks a list of resource records from the // received byte slice UnpackRRList(uint16, []byte, int) ([]rr.RR, int, error) // UnpackRR unpacks a single resource record from the // received byte slice UnpackRR([]byte, int) (rr.RR, int, error) // UnpackRRHeader unpacks header data of a resource // record from the received byte slice UnpackRRHeader([]byte, int) (rr.Header, int, error) }
func NewDefaultUnpacker ¶
func NewDefaultUnpacker() Unpacker
NewDefaultUnpacker creates a new default wrapper instance