Documentation ¶
Index ¶
- Variables
- func GetExternal() (net.IPAddr, error)
- func GetExternalOrDefault(defaultAddr net.IPAddr) net.IPAddr
- func GetPrivate() ([]net.IPAddr, error)
- func GetPrivateOrDefault(addr net.IPAddr) net.IPAddr
- func GetPublic() ([]net.IPAddr, error)
- func GetPublicOrDefault(addr net.IPAddr) net.IPAddr
- func Parse(addr string, defaultPort int) (*net.TCPAddr, error)
- func Resolve(name string, defaultPort int) ([]net.TCPAddr, error)
- type Fingerprint
Constants ¶
This section is empty.
Variables ¶
var Loopback = net.IPAddr{IP: net.ParseIP("127.0.0.1")}
Loopback is the default loopback address (127.0.0.1)
Functions ¶
func GetExternal ¶
GetExternal returns an externally visible IP Address. This actually goes out to the internet service which echoes the address.
func GetExternalOrDefault ¶
GetExternalOrDefault returns an externally visible IP Address. If no address is available, this defaults to the specified default address.
func GetPrivate ¶
GetPrivate returns the list of private network IPv4 addresses on all active interfaces.
func GetPrivateOrDefault ¶
GetPrivateOrDefault returns the first private IPv4 address. If no address is available, this defaults to the specified default address.
func GetPublicOrDefault ¶
GetPublicOrDefault returns the first public IP address. If no address is available, this defaults to the specified default address.
Types ¶
type Fingerprint ¶
type Fingerprint uint64
Fingerprint represents hardware fingerprint
func GetHardware ¶
func GetHardware() Fingerprint
GetHardware retrieves the hardware address fingerprint which is based on the address of the first interface encountered.
func (Fingerprint) String ¶
func (f Fingerprint) String() string
String encodes PeerName as a string.