xnet

package
v2.6.5 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 3 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignRandPort

func AssignRandPort(ip ...string) (int, error)

AssignRandPort allocates a free random port, optionally bound to one of the given IP addresses.

func ExternalIP

func ExternalIP() (string, error)

ExternalIP returns the external IP address.

func ExtractIP

func ExtractIP(addr net.Addr) (string, error)

ExtractIP extracts the host IP address from addr.

func ExtractPort

func ExtractPort(addr net.Addr) (int, error)

ExtractPort extracts the host port from addr.

func FulfillAddr

func FulfillAddr(addr string) string

FulfillAddr completes addr so that it is a valid, fully qualified address.

func IP2Long added in v2.1.0

func IP2Long(ip string) uint32

IP2Long converts an IPv4 address into its uint32 representation. It returns 0 when ip is not a valid IPv4 address.

func InternalIP

func InternalIP() (string, error)

InternalIP returns the internal (private) IP address.

func Long2IP added in v2.1.0

func Long2IP(v uint32) string

Long2IP converts a uint32 into its dotted-decimal IPv4 address string.

func PrivateIP added in v2.3.0

func PrivateIP() (string, error)

PrivateIP returns the private IP address.

func PublicIP added in v2.3.0

func PublicIP() (string, error)

PublicIP returns the public IP address.

Types

This section is empty.

Jump to

Keyboard shortcuts

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