dnsutils

package
v5.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IP4arpa = ".in-addr.arpa."
	IP6arpa = ".ip6.arpa."
)

Variables

This section is empty.

Functions

func AddECS

func AddECS(opt *dns.OPT, ecs *dns.EDNS0_SUBNET, overwrite bool) (newECS bool)

AddECS adds ecs to opt.

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 GetECS

func GetECS(opt *dns.OPT) (e *dns.EDNS0_SUBNET)

func GetEDNS0Option

func GetEDNS0Option(opt *dns.OPT, option uint16) dns.EDNS0

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 GetMsgECS

func GetMsgECS(m *dns.Msg) (e *dns.EDNS0_SUBNET)

func NewEDNS0Subnet

func NewEDNS0Subnet(ip net.IP, mask uint8, v6 bool) *dns.EDNS0_SUBNET

func PadToMinimum

func PadToMinimum(m *dns.Msg, minLen int) (upgraded, newPadding bool)

PadToMinimum pads m to the minimum length. If the length of m is larger than minLen, PadToMinimum won't do anything. upgraded indicates the m was upgraded to an EDNS0 msg. newPadding indicates the Padding option is new to m.

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, int, 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 RemoveECS

func RemoveECS(opt *dns.OPT)

func RemoveEDNS0

func RemoveEDNS0(m *dns.Msg)

RemoveEDNS0 removes the OPT record from m.

func RemoveEDNS0Option

func RemoveEDNS0Option(opt *dns.OPT, option uint16)

func RemoveMsgECS

func RemoveMsgECS(m *dns.Msg)

RemoveMsgECS removes the *dns.EDNS0_SUBNET record in m.

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 UpgradeEDNS0

func UpgradeEDNS0(m *dns.Msg) *dns.OPT

UpgradeEDNS0 enables EDNS0 for m and returns it's dns.OPT record. m must be a msg without dns.OPT.

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