Documentation ¶
Index ¶
- Constants
- func AppendECS(m *dns.Msg, ecs *dns.EDNS0_SUBNET) *dns.Msg
- func ApplyMaximumTTL(m *dns.Msg, ttl uint32)
- func ApplyMinimalTTL(m *dns.Msg, ttl uint32)
- 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 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(m *dns.Msg) (removedECS *dns.EDNS0_SUBNET)
- 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) (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 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 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 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.