Documentation ¶
Overview ¶
Utilities for working with networks and network accessories.
Index ¶
- Variables
- func DefaultGateway() (net.IP, error)
- func EphemeralPort() (int, error)
- func ExpandPort(address string) string
- func FQDN() string
- func HasRoutableIP(network string, ifi *net.Interface) (net.IP, bool)
- func IsMulticastCapable(network string, ifi *net.Interface) (net.IP, bool)
- func IsRoutableIP(network string, ip net.IP) net.IP
- func RoutedInterface(network string, flags net.Flags) *net.Interface
- func WaitForOpen(network string, address string, totaltime time.Duration, ...) error
- func ZeroconfDiscover(options *ZeroconfOptions, fn ServiceFunc) error
- func ZeroconfRegister(svc *Service) (string, error)
- func ZeroconfUnregister(id string)
- func ZeroconfUnregisterAll()
- type IPAddress
- type Service
- type ServiceFunc
- type ZeroconfOptions
Constants ¶
This section is empty.
Variables ¶
var DefaultWaitForOpenConnectionTimeout = 5 * time.Second
var WaitForOpenCheckInterval = time.Second
Functions ¶
func DefaultGateway ¶ added in v1.6.12
Retrieves the default gateway interface.
func EphemeralPort ¶ added in v1.5.56
Retrieve an open ephemeral port.
func ExpandPort ¶ added in v1.5.57
Takes an address in the form of "host:port", looks for port zero (e.g: ":0"), and gets an ephemeral local port and returns that address (e.g.: ":41327").
func FQDN ¶ added in v1.7.37
func FQDN() string
Return the current machine's Fully-qualified domain name,
func HasRoutableIP ¶ added in v1.6.9
Returns the first routable address on the given interface.
func IsMulticastCapable ¶ added in v1.6.9
IsMulticastCapable reports whether ifi is an IP multicast-capable network interface. Network must be "ip", "ip4" or "ip6".
func IsRoutableIP ¶ added in v1.6.9
Returns true when the given address is unicast routable beyond the current machine.
func RoutedInterface ¶ added in v1.6.9
RoutedInterface returns a network interface that can route IP traffic and satisfies flags. It returns nil when an appropriate network interface is not found. Network must be "ip", "ip4" or "ip6".
func WaitForOpen ¶
func ZeroconfDiscover ¶ added in v1.7.33
func ZeroconfDiscover(options *ZeroconfOptions, fn ServiceFunc) error
Perform Multicast DNS discovery on the local network, calling the fn callback for each discovered service.
func ZeroconfRegister ¶ added in v1.7.33
Register the given service in Multicast DNS. Returns an ID that can be used to unregister the service later.
func ZeroconfUnregister ¶ added in v1.7.33
func ZeroconfUnregister(id string)
Unregister a previously-registered service.
func ZeroconfUnregisterAll ¶ added in v1.7.33
func ZeroconfUnregisterAll()
Unregister all Multicast DNS services.
Types ¶
type IPAddress ¶ added in v1.6.12
func DefaultAddress ¶ added in v1.6.12
func DefaultAddress() *IPAddress
Retrieves the first routable IP address on any interface that falls inside of the system's default gateway network. Will return nil if no IP could be found.
func RoutableAddresses ¶ added in v1.6.12
Return a list of routable IP addresses, along with their associated gateways and interfaces.
type Service ¶ added in v1.7.33
type Service struct { Hostname string `json:"hostname"` Instance string `json:"instance"` Service string `json:"service"` Domain string `json:"domain"` Port int `json:"port"` Text []string `json:"txt"` Address string `json:"address"` Addresses []net.IP `json:"addresses,omitempty"` Interfaces []net.Interface `json:"interfaces,omitempty"` }