models

package
v0.0.0-...-446b5b2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// QType
	ARecord    QType = 1
	NameServer QType = 2
	CName      QType = 5
	SOA        QType = 6
	WKS        QType = 11
	PTR        QType = 12
	HInfo      QType = 13
	MInfo      QType = 14
	MX         QType = 15
	TXT        QType = 16

	// QClass
	QCIN QClass = 1
	QCCH QClass = 3
	QCHS QClass = 4

	OpCodeStandard OpCode = 0
	OpCodeInverse  OpCode = 1 << 12
	ServerStatus   OpCode = 1 << 13

	AA uint16 = 1 << 10
	TC uint16 = 1 << 9
	RD uint16 = 1 << 8
	RA uint16 = 1 << 7

	QRResponseFlag uint16 = 1 << 15

	RCodeNoError        uint16 = 0
	RCodeFormaterror    uint16 = 1
	RCodeServerFailure  uint16 = 2
	RCodeNameError      uint16 = 3
	RCodeNotImplemented uint16 = 4
	RCodeRefused        uint16 = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DNSHeader

type DNSHeader struct {
	ID        uint16
	MiscFlags uint16
	QDCount   uint16
	ANCount   uint16
	NSCount   uint16
	ADCount   uint16
}

DNSHeader... first 12 bytes of the UDP packet. See https://routley.io/tech/2017/12/28/hand-writing-dns-messages.html for great explanation about this!

func (DNSHeader) ToString

func (h DNSHeader) ToString() string

type DNSQuestion

type DNSQuestion struct {
	Domain string
	QT     QType
	QC     QClass
}

func (DNSQuestion) ToString

func (q DNSQuestion) ToString() string

type DNSRequest

type DNSRequest struct {
	QuerySlice []DNSQuestion
}

DNSRequest is DNS Request (duh). Within a single request there can actually be multiple domains to lookup.

type DNSResourceRecord

type DNSResourceRecord struct {
	DomainName string
	QType      QType
	QClass     QClass
	TTL        uint32
	DataLength uint16
	Data       []byte
}

DNSResourceRecord used for answers, authority records and additional records

func (DNSResourceRecord) ToString

func (r DNSResourceRecord) ToString() string

type OpCode

type OpCode uint16

type QClass

type QClass uint16

type QType

type QType uint16

type RawDNSRequest

type RawDNSRequest struct {
	RawBytes   []byte
	ClientAddr *net.UDPAddr
}

RawDNSRequest is the raw information from the socket. This includes the byte array and the client details of the request (so we know where to respond to).

Jump to

Keyboard shortcuts

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