util

package
v0.0.0-...-daf700f Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IPV4MaskBitsMax     = net.IPv4len * 8
	IPV4MaskBitsDefault = 24 // RFC 7871 Section 11.1
	IPV6MaskBitsMax     = net.IPv6len * 8
	IPV6MaskBitsDefault = 56 // RFC 7871 Section 11.1

)

Variables

This section is empty.

Functions

func DNSNewNXDomain

func DNSNewNXDomain(source *dns.Msg) *dns.Msg

func DNSNewResponseByAnswer

func DNSNewResponseByAnswer(req *dns.Msg, answer []dns.RR) *dns.Msg

func DNSNewSubnetFromIP

func DNSNewSubnetFromIP(ip net.IP, maskBits uint8) *dns.EDNS0_SUBNET

func DNSSetSUBNET

func DNSSetSUBNET(m *dns.Msg, subnet *dns.EDNS0_SUBNET)

DNSSetSUBNET set the EDNS client subnet option return true only when the subnet added to m

func DNSSplitAnswer

func DNSSplitAnswer(rr dns.RR) net.IP

func DNSSubnetExist

func DNSSubnetExist(m *dns.Msg) bool

func DNSSubnetRemove

func DNSSubnetRemove(m *dns.Msg)

DNSSubnetRemove set the EDNS client subnet option return true only when the subnet added to m

func GetOOBWithSrc

func GetOOBWithSrc(ip net.IP) []byte

GetOOBWithSrc makes the OOB data with a specified source IP.

func GetPublicIPV4

func GetPublicIPV4() (net.IP, error)

func GetPublicIPV6

func GetPublicIPV6() (net.IP, error)

func Ping

func Ping(host string) uint32

Ping return the minimum latency in millisecond host : (net.IP).String() when dial error or timeout, return math.MaxUint32

func Read

func Read(c *net.UDPConn, buf []byte) (n int, remoteAddr *net.UDPAddr, err error)

func SetControlMessage

func SetControlMessage(conn *net.UDPConn) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL