Documentation
¶
Index ¶
- Constants
- func AssignRandPort(ip ...string) (int, error)
- func ExternalIP() (string, error)deprecated
- func ExtractIP(addr net.Addr) (ip string, err error)
- func ExtractPort(addr net.Addr) (int, error)
- func FulfillAddr(addr string) string
- func InternalIP() (string, error)deprecated
- func ParseAddr(addr string, expose ...bool) (string, string, error)
- func ParseHostPort(endpoint string) (string, uint64, error)
- func PrivateIP() (string, error)
- func PublicIP() (string, error)
- func SetPrivateIPResolver(resolver IPResolver)
- func SetPublicIPResolver(resolver IPResolver)
- type IPResolver
Constants ¶
const ( IPv4Zero = "0.0.0.0" IPv4Loopback = "127.0.0.1" )
Variables ¶
This section is empty.
Functions ¶
func AssignRandPort ¶
AssignRandPort assigns a random port, optionally bound to ip.
func ExternalIP
deprecated
ExternalIP returns the external IP address.
Deprecated: As of due v2.3.0, this function simply calls net.PublicIP.
func ExtractPort ¶
ExtractPort extracts the port from addr.
func FulfillAddr ¶
FulfillAddr completes addr with the default host when it is missing.
func InternalIP
deprecated
InternalIP returns the internal IP address.
Deprecated: As of due v2.3.0, this function simply calls net.PublicIP.
func ParseAddr ¶
ParseAddr parses addr into a listen address and an expose address.
The expose IP is only resolved automatically from the expose argument when addr is 0.0.0.0:[port] or :[port].
func ParseHostPort ¶ added in v2.6.0
ParseHostPort parses an endpoint into a host and a port.
func SetPrivateIPResolver ¶ added in v2.3.3
func SetPrivateIPResolver(resolver IPResolver)
SetPrivateIPResolver sets the private IP resolver.
func SetPublicIPResolver ¶ added in v2.3.3
func SetPublicIPResolver(resolver IPResolver)
SetPublicIPResolver sets the public IP resolver.