Documentation
¶
Index ¶
- Variables
- func AddrPortDetailsFromString(addrPort string) (netip.AddrPort, string, error)
- func ConvertAddrToIP(addr netip.Addr) net.IP
- func ExpandStringTemplate(templateString string, data any) (string, error)
- func FindInterfaceForAddr(a netip.Addr) (string, error)
- func FindInterfaceForIP(ip net.IP) (string, error)
- func FindTCPConn(c RawConn) *net.TCPConn
- func GetMyIPs(ctx context.Context) ([]netip.Addr, error)
- func GetMyIPsFromFuncs(ctx context.Context, funcs ...GetIPFunc) ([]netip.Addr, error)
- func GetMyIPv4(ctx context.Context) (netip.Addr, error)
- func GetMyIPv6(ctx context.Context) (netip.Addr, error)
- func TCPAddrFromURL(url *url.URL) (string, error)
- func TCPPortFromURL(url *url.URL) (string, error)
- type DoneConn
- type GetIPFunc
- type RawConn
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // TODO: change this to ipv4.myip.dioad.net(A) ipv6.myip.dioad.net (AAAA) and myip.dioad.net(A and AAAA) // IPv4ICanHazIP is the URL to fetch the public IPv4 address. IPv4ICanHazIP = "http://ipv4.icanhazip.com" // IPv6ICanHazIP is the URL to fetch the public IPv6 address. IPv6ICanHazIP = "http://ipv6.icanhazip.com" )
Functions ¶
func AddrPortDetailsFromString ¶
AddrPortDetailsFromString takes a string representation of an address:port combination and returns the parsed netip.AddrPort, the network interface name that contains this address, and any error encountered during parsing or interface lookup. The input string should be in the format "IP:port" (e.g., "192.168.1.1:8080" or "[::1]:80"). Returns an empty AddrPort and empty string if an error occurs.
func ExpandStringTemplate ¶
func FindTCPConn ¶ added in v0.46.0
func GetMyIPsFromFuncs ¶ added in v0.45.3
GetMyIPsFromFuncs fetches the public IP addresses using the provided functions.
func TCPAddrFromURL ¶
TCPAddrFromURL returns a TCP address in the form of "host:port" from a given URL.
Types ¶
type DoneConn ¶ added in v0.44.0
func NewDoneConn ¶ added in v0.44.0
Click to show internal directories.
Click to hide internal directories.