Documentation ¶
Index ¶
- Variables
- func Discover() (e error)
- func GetAddressesAndInterfaces() (Interfaces []*net.Interface, Addresses map[string]struct{})
- func GetAllInterfacesAndAddresses() (interfaces []*net.Interface, udpAddrs []*net.UDPAddr)
- func GetInterface() (ifc *net.Interface, address string, e error)
- func GetListenable() net.IP
Constants ¶
This section is empty.
Variables ¶
var Address net.IP
Address is the network address that routes to the gateway and thus the internet
var Gateway net.IP
Gateway stores the current network default gateway as discovered by github.com/jackpal/gateway
var IPNet *net.IPNet
IPNet is the subnet of the Gateway's LAN
var Interface *net.Interface
Interface is the net.Interface of the Address above
var SecondaryAddresses []net.IP
SecondaryAddresses are all the other addresses that can be reached from somewhere (including localhost) but not necessarily the internet
var SecondaryInterfaces []*net.Interface
SecondaryInterfaces is the interfaces of the SecondaryAddresses stored in the corresponding slice index
Functions ¶
func Discover ¶ added in v1.9.16
func Discover() (e error)
Discover enumerates and evaluates all known network interfaces and addresses and filters it down to the ones that reach both a LAN and the internet
We are only interested in IPv4 addresses because for the most part, domestic ISPs do not issue their customers with IPv6 routing, it's still a pain in the ass outside of large data centre connections
func GetAddressesAndInterfaces ¶ added in v1.9.16
GetAddressesAndInterfaces returns all of the addresses and interfaces that would be resolved from an automatic addresses that can connect two processes at all
func GetAllInterfacesAndAddresses ¶ added in v1.9.16
func GetInterface ¶
GetInterface returns the address and interface of multicast-and-internet capable interfaces
func GetListenable ¶ added in v1.9.16
Types ¶
This section is empty.