Documentation
¶
Index ¶
- func FindLoopbackIPv4Interface() net.Interface
- func FindPublicIPv4() (net.IP, error)
- func FreeTCPPort() (int, error)
- func FreeUDPPort() (int, error)
- func IsLoopbackAddress(listenAddress string) bool
- func PortOfHostPort(hostport string) int
- func RandomLocalEndpoint() string
- func RandomPublicEndpoint() string
- func ServiceHostPort(addr net.Addr) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindLoopbackIPv4Interface ¶
FindLoopbackIPv4Interface finds the IPv4 loopback interface. It's usually the one with the 127.0.0.1 address but you never know what sort of crazy config you can stumble upon.
func FindPublicIPv4 ¶
FindPublicIPv4 returns the public IPv4 address of the computer. If there's more than one public IP(v4) address the first found is returned. Docker interfaces and interfaces with index > 100 is skipped
func FreeTCPPort ¶
FreeTCPPort returns a free TCP port by using net.ListenTCP on port :0
func FreeUDPPort ¶
FreeUDPPort returns a free UDP port by using net.ListenUDP on port :0
func IsLoopbackAddress ¶ added in v1.0.3
IsLoopbackAddress returns true if the listen address (host:port) points at a loopback address. IPv6 addresses aren't supported.
func PortOfHostPort ¶
PortOfHostPort returns the port number for the host:port string. If there's an error it will panic -- use with caution.
func RandomLocalEndpoint ¶
func RandomLocalEndpoint() string
RandomLocalEndpoint returns a random endpoint on the loppback interface.
func RandomPublicEndpoint ¶
func RandomPublicEndpoint() string
RandomPublicEndpoint returns a random public endpoint on the host. It will use the first IPv4 address found on the host.
func ServiceHostPort ¶ added in v1.0.7
ServiceHostPort returns the listener address as a host:port string. If the listener address points at a loopback address it will return the address of the loopback adapter.
Types ¶
This section is empty.