Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyMaximumTTL(m *dns.Msg, ttl uint32)
- func ApplyMinimalTTL(m *dns.Msg, ttl uint32)
- func FakeSOA(name string) *dns.SOA
- func GenEmptyReply(q *dns.Msg, rcode int) *dns.Msg
- func GetMinimalTTL(m *dns.Msg) uint32
- func ParsePTRQName(fqdn string) (netip.Addr, error)
- func QclassToString(u uint16) string
- func QtypeToString(u uint16) string
- func ReadMsgFromTCP(c io.Reader) (*dns.Msg, int, error)
- func ReadMsgFromUDP(c io.Reader, bufSize int) (*dns.Msg, int, error)
- func ReadRawMsgFromTCP(c io.Reader) (*[]byte, error)
- func SetTTL(m *dns.Msg, ttl uint32)
- func SubtractTTL(m *dns.Msg, delta uint32) (overflowed bool)
- func WriteMsgToTCP(c io.Writer, m *dns.Msg) (n int, err error)
- func WriteMsgToUDP(c io.Writer, m *dns.Msg) (int, error)
- func WriteRawMsgToTCP(c io.Writer, b []byte) (n int, err error)
Constants ¶
const ( IP4arpa = ".in-addr.arpa." IP6arpa = ".ip6.arpa." )
const (
DnsHeaderLen = 12 // minimum dns msg size
)
Variables ¶
var (
ErrPayloadTooSmall = errors.New("payload is to small for a valid dns msg")
)
Functions ¶
func ApplyMaximumTTL ¶
func ApplyMinimalTTL ¶
func GetMinimalTTL ¶
GetMinimalTTL returns the minimal ttl of this msg. If msg m has no record, it returns 0.
func ParsePTRQName ¶
ParsePTRQName returns the ip that a PTR query name contains.
func QclassToString ¶
func QtypeToString ¶
func ReadMsgFromTCP ¶
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 ReadRawMsgFromTCP ¶
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 SubtractTTL ¶
SubtractTTL subtract delta from every m's RR. If RR's TTL is smaller than delta, SubtractTTL will return overflowed = true.
func WriteMsgToTCP ¶
WriteMsgToTCP packs and writes m to c in RFC 1035 format. n represents how many bytes are written to c.
Types ¶
This section is empty.