Documentation
¶
Overview ¶
Package proxyutil contains helper functions that are used in all other dnsproxy packages
Index ¶
- Constants
- func AddPrefix(b []byte) (m []byte)
- func AppendIPAddrs(ipAddrs *[]net.IPAddr, answers []dns.RR)
- func ContainsIP(nets []*net.IPNet, ip net.IP) (ok bool)
- func DNSSize(isUDP bool, r *dns.Msg) int
- func IPFromRR(rr dns.RR) (ip net.IP)
- func ReadPrefixed(conn net.Conn) ([]byte, error)
- func SortIPAddrs(ipAddrs []net.IPAddr) []net.IPAddrdeprecated
- func UDPGetOOBSize() (oobSize int)deprecated
- func UDPRead(c *net.UDPConn, buf []byte, udpOOBSize int) (n int, localIP net.IP, remoteAddr *net.UDPAddr, err error)deprecated
- func UDPSetOptions(c *net.UDPConn) (err error)deprecated
- func UDPWrite(data []byte, conn *net.UDPConn, remoteAddr *net.UDPAddr, localIP net.IP) (n int, err error)deprecated
- func WritePrefixed(b []byte, conn net.Conn) error
Constants ¶
const ErrTooLarge errors.Error = "dns message is too large"
ErrTooLarge means that a DNS message is larger than 64KiB.
Variables ¶
This section is empty.
Functions ¶
func AppendIPAddrs ¶
AppendIPAddrs appends the IP addresses got from dns.RR to the specified array
func ContainsIP ¶ added in v0.28.0
ContainsIP returns true if any of nets contains ip.
func DNSSize ¶ added in v0.33.0
DNSSize returns if buffer size *advertised* in the requests OPT record. Or when the request was over TCP, we return the maximum allowed size of 64K.
func ReadPrefixed ¶ added in v0.33.0
ReadPrefixed reads a DNS message with a 2-byte prefix containing message length from conn.
func SortIPAddrs
deprecated
func UDPGetOOBSize
deprecated
added in
v0.33.0
func UDPGetOOBSize() (oobSize int)
UDPGetOOBSize returns maximum size of the received OOB data.
Deprecated: This function is deprecated. Packages in module dnsproxy should use internal/netutil.UDPGetOOBSize instead.
func UDPRead
deprecated
added in
v0.33.0
func UDPRead( c *net.UDPConn, buf []byte, udpOOBSize int, ) (n int, localIP net.IP, remoteAddr *net.UDPAddr, err error)
UDPRead udpRead reads the message from c using buf receives payload of size udpOOBSize from the UDP socket. It returns the number of bytes copied into buf, the number of bytes copied with OOB and the source address of the message.
Deprecated: This function is deprecated. Packages in module dnsproxy should use internal/netutil.UDPRead instead.
func UDPSetOptions
deprecated
added in
v0.33.0
func UDPWrite
deprecated
added in
v0.33.0
Types ¶
This section is empty.