dnsutils

package
v5.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IP4arpa = ".in-addr.arpa."
	IP6arpa = ".ip6.arpa."
)
View Source
const (
	DnsHeaderLen = 12 // minimum dns msg size
)

Variables

View Source
var (
	ErrPayloadTooSmall = errors.New("payload is to small for a valid dns msg")
)

Functions

func ApplyMaximumTTL

func ApplyMaximumTTL(m *dns.Msg, ttl uint32)

func ApplyMinimalTTL

func ApplyMinimalTTL(m *dns.Msg, ttl uint32)

func FakeSOA

func FakeSOA(name string) *dns.SOA

func GenEmptyReply

func GenEmptyReply(q *dns.Msg, rcode int) *dns.Msg

func GetMinimalTTL

func GetMinimalTTL(m *dns.Msg) uint32

GetMinimalTTL returns the minimal ttl of this msg. If msg m has no record, it returns 0.

func ParsePTRQName

func ParsePTRQName(fqdn string) (netip.Addr, error)

ParsePTRQName returns the ip that a PTR query name contains.

func QclassToString

func QclassToString(u uint16) string

func QtypeToString

func QtypeToString(u uint16) string

func ReadMsgFromTCP

func ReadMsgFromTCP(c io.Reader) (*dns.Msg, int, error)

ReadMsgFromTCP reads msg from c in RFC 1035 format (msg is prefixed with a two byte length field). n represents how many bytes are read from c.

func ReadMsgFromUDP

func ReadMsgFromUDP(c io.Reader, bufSize int) (*dns.Msg, int, error)

func ReadRawMsgFromTCP

func ReadRawMsgFromTCP(c io.Reader) (*[]byte, error)

ReadRawMsgFromTCP reads msg from c in RFC 1035 format (msg is prefixed with a two byte length field). n represents how many bytes are read from c. The returned the *[]byte should be released by pool.ReleaseBuf.

func SetTTL

func SetTTL(m *dns.Msg, ttl uint32)

SetTTL updates all records' ttl to ttl, except opt record.

func SubtractTTL

func SubtractTTL(m *dns.Msg, delta uint32) (overflowed bool)

SubtractTTL subtract delta from every m's RR. If RR's TTL is smaller than delta, SubtractTTL will return overflowed = true.

func WriteMsgToTCP

func WriteMsgToTCP(c io.Writer, m *dns.Msg) (n int, err error)

WriteMsgToTCP packs and writes m to c in RFC 1035 format. n represents how many bytes are written to c.

func WriteMsgToUDP

func WriteMsgToUDP(c io.Writer, m *dns.Msg) (int, error)

func WriteRawMsgToTCP

func WriteRawMsgToTCP(c io.Writer, b []byte) (n int, err error)

WriteRawMsgToTCP See WriteMsgToTCP

Types

This section is empty.

Jump to

Keyboard shortcuts

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