msg

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package msg helps to build a dnstap Message.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(m *lib.Message) (data []byte, err error)

Marshal encodes the message to a binary dnstap payload.

func Wrap

func Wrap(m *lib.Message) lib.Dnstap

Wrap a dnstap message in the top-level dnstap type.

Types

type Builder

type Builder struct {
	Full bool
	Data
}

Builder helps to build Data by being aware of the dnstap plugin configuration.

func (*Builder) AddrMsg

func (b *Builder) AddrMsg(a net.Addr, m *dns.Msg) (err error)

AddrMsg parses the info of net.Addr and dns.Msg.

func (*Builder) Msg

func (b *Builder) Msg(m *dns.Msg) (err error)

Msg parses the info of dns.Msg.

type Data

type Data struct {
	Packed      []byte
	SocketProto tap.SocketProtocol
	SocketFam   tap.SocketFamily
	Address     []byte
	Port        uint32
	TimeSec     uint64
}

Data helps to build a dnstap Message. It can be transformed into the actual Message using this package.

func (*Data) HostPort

func (d *Data) HostPort(addr string) error

HostPort decodes into Data any string returned by dnsutil.ParseHostPortOrFile.

func (*Data) Pack

func (d *Data) Pack(m *dns.Msg) error

Pack encodes the DNS message into Data.

func (*Data) RemoteAddr

func (d *Data) RemoteAddr(remote net.Addr) error

RemoteAddr parses the information about the remote address into Data.

func (*Data) ToClientQuery

func (d *Data) ToClientQuery() *tap.Message

ToClientQuery transforms Data into a client query message.

func (*Data) ToClientResponse

func (d *Data) ToClientResponse() *tap.Message

ToClientResponse transforms Data into a client response message.

func (*Data) ToOutsideQuery

func (d *Data) ToOutsideQuery(t tap.Message_Type) *tap.Message

ToOutsideQuery transforms the data into a forwarder or resolver query message.

func (*Data) ToOutsideResponse

func (d *Data) ToOutsideResponse(t tap.Message_Type) *tap.Message

ToOutsideResponse transforms the data into a forwarder or resolver response message.

Jump to

Keyboard shortcuts

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