Documentation
¶
Index ¶
- func AssignRandPort(ip ...string) (int, error)
- func Bytes2IP(v [16]byte) string
- func ExternalIP() (string, error)
- func ExtractIP(addr net.Addr) (string, error)
- func ExtractPort(addr net.Addr) (int, error)
- func FulfillAddr(addr string) string
- func IP2Bytes(ip string) [16]byte
- func IP2Long(ip string) uint32
- func InternalIP() (string, error)
- func Long2IP(v uint32) string
- func PrivateIP() (string, error)
- func PublicIP() (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssignRandPort ¶
AssignRandPort allocates a free random port, optionally bound to one of the given IP addresses.
func Bytes2IP ¶ added in v2.6.7
Bytes2IP converts a 16-byte network-order address into its string representation. IPv4-mapped addresses are rendered as dotted-decimal IPv4.
func ExtractPort ¶
ExtractPort extracts the host port from addr.
func FulfillAddr ¶
FulfillAddr completes addr with the dual-stack wildcard host when the host is missing.
func IP2Bytes ¶ added in v2.6.7
IP2Bytes converts an IP address into its 16-byte network-order representation. IPv4 addresses use the IPv4-mapped IPv6 form, so Bytes2IP can restore the dotted-decimal string. Invalid addresses return the zero value.
func IP2Long ¶ added in v2.1.0
IP2Long converts an IPv4 address into its uint32 representation. It returns 0 when ip is not a valid IPv4 address.
func InternalIP ¶
InternalIP returns the internal (private) IP address.
func Long2IP ¶ added in v2.1.0
Long2IP converts a uint32 into its dotted-decimal IPv4 address string.
Types ¶
This section is empty.