Documentation ¶
Index ¶
- Constants
- func AddECS(opt *dns.OPT, ecs *dns.EDNS0_SUBNET, overwrite bool) (newECS bool)
- 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 GetECS(opt *dns.OPT) (e *dns.EDNS0_SUBNET)
- func GetEDNS0Option(opt *dns.OPT, option uint16) dns.EDNS0
- func GetMinimalTTL(m *dns.Msg) uint32
- func GetMsgECS(m *dns.Msg) (e *dns.EDNS0_SUBNET)
- func IsIOErr(err error) (innerErr error)
- func NewEDNS0Subnet(ip net.IP, mask uint8, v6 bool) *dns.EDNS0_SUBNET
- func PadToMinimum(m *dns.Msg, minLen int) (upgraded, newPadding bool)
- func QclassToString(u uint16) string
- func QtypeToString(u uint16) string
- func ReadMsgFromTCP(c io.Reader) (m *dns.Msg, n int, err error)
- func ReadMsgFromUDP(c io.Reader, bufSize int) (m *dns.Msg, n int, err error)
- func ReadUDPMsgFrom(c net.PacketConn, bufSize int) (m *dns.Msg, from net.Addr, n int, err error)
- func RemoveECS(opt *dns.OPT)
- func RemoveEDNS0(m *dns.Msg)
- func RemoveEDNS0Option(opt *dns.OPT, option uint16)
- func RemoveMsgECS(m *dns.Msg)
- func SetTTL(m *dns.Msg, ttl uint32)
- func SubtractTTL(m *dns.Msg, delta uint32) (overflowed bool)
- func UpgradeEDNS0(m *dns.Msg) *dns.OPT
- func WriteMsgToTCP(c io.Writer, m *dns.Msg) (n int, err error)
- func WriteMsgToUDP(c io.Writer, m *dns.Msg) (n int, err error)
- func WriteRawMsgToTCP(c io.Writer, b []byte) (n int, err error)
- func WriteRawMsgToUDP(c io.Writer, b []byte) (n int, err error)
- func WriteUDPMsgTo(m *dns.Msg, c net.PacketConn, to net.Addr) (n int, err error)
- type IOErr
Constants ¶
const ( IPv4UdpMaxPayload = 1472 // MTU 1500 - 20 IPv4 header - 8 udp header IPv6UdpMaxPayload = 1452 // MTU 1500 - 40 IPv6 header - 8 udp header )
Variables ¶
This section is empty.
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 NewEDNS0Subnet ¶
func PadToMinimum ¶ added in v2.2.1
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 QclassToString ¶
func QtypeToString ¶
func ReadMsgFromTCP ¶
ReadMsgFromTCP reads msg from c in RFC 7766 format. n represents how many bytes are read from c. This includes two-octet length field. An io err will be wrapped into an IOErr. IsIOErr(err) can check and unwrap the inner io err.
func ReadMsgFromUDP ¶
ReadMsgFromUDP See ReadUDPMsgFrom.
func ReadUDPMsgFrom ¶
ReadUDPMsgFrom reads dns msg from c in a wire format. The bufSize should not be greater than dns.MaxMsgSize. Typically IPv4UdpMaxPayload is big enough. An io err will be wrapped into an IOErr. IsIOErr(err) can check and unwrap the inner io err.
func RemoveEDNS0 ¶ added in v2.2.1
RemoveEDNS0 removes the OPT record from m.
func RemoveEDNS0Option ¶ added in v2.2.1
func RemoveMsgECS ¶ added in v2.2.1
RemoveMsgECS removes the *dns.EDNS0_SUBNET record in m.
func SubtractTTL ¶
SubtractTTL subtract delta from every m's RR. If RR's TTL is smaller than delta, SubtractTTL will return overflowed = true.
func UpgradeEDNS0 ¶ added in v2.2.1
UpgradeEDNS0 enables EDNS0 for m and returns it's dns.OPT record. m must be a msg without dns.OPT.
func WriteMsgToTCP ¶
WriteMsgToTCP packs and writes m to c in RFC 7766 format. n represents how many bytes are written to c. This includes 2 bytes length header. An io err will be wrapped into an IOErr. IsIOErr(err) can check and unwrap the inner io err.
func WriteMsgToUDP ¶
WriteMsgToUDP packs and writes m to c in a wire format. An io err will be wrapped into an IOErr. IsIOErr(err) can check and unwrap the inner io err.
func WriteRawMsgToTCP ¶
WriteRawMsgToTCP See WriteMsgToTCP
func WriteRawMsgToUDP ¶
WriteRawMsgToUDP See WriteMsgToUDP.
func WriteUDPMsgTo ¶
WriteUDPMsgTo See WriteMsgToUDP.