query

package
v1.43.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EDNS0_SUBNET = 0x8
	EDNS0_MAC    = 0xfde9 // as defined by dnsmasq --add-mac feature
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Class

type Class uint16
const (
	// ResourceHeader.Class and Question.Class
	ClassINET   Class = 1
	ClassCSNET  Class = 2
	ClassCHAOS  Class = 3
	ClassHESIOD Class = 4

	// Question.Class
	ClassANY Class = 255
)

func (Class) String

func (c Class) String() string

type Query

type Query struct {
	ID               uint16
	Class            Class
	Type             Type
	RecursionDesired bool
	MsgSize          uint16
	Name             string
	LocalIP          net.IP
	PeerIP           net.IP
	MAC              net.HardwareAddr
	Payload          []byte
}

func New

func New(payload []byte, peerIP, localIP net.IP) (Query, error)

New lasily parses payload and extract the queried name, ip/MAC if present in the query as EDNS0 extension. ARP queries are performed to find MAC or IP depending on which one is present or not in the query.

type Type

type Type uint16
const (
	// ResourceHeader.Type and Question.Type
	TypeA     Type = 1
	TypeNS    Type = 2
	TypeCNAME Type = 5
	TypeSOA   Type = 6
	TypePTR   Type = 12
	TypeMX    Type = 15
	TypeTXT   Type = 16
	TypeAAAA  Type = 28
	TypeSRV   Type = 33
	TypeOPT   Type = 41

	// Question.Type
	TypeWKS   Type = 11
	TypeHINFO Type = 13
	TypeMINFO Type = 14
	TypeAXFR  Type = 252
	TypeALL   Type = 255
)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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