Documentation ¶
Index ¶
- func DetectAddress(detector string, addrType AddressType, ifaceNames []string) (string, error)
- func DetectByInterface(addrType AddressType, ifaceNames []string) (string, error)
- func Resolve(servers []string, recordType uint16, name string) string
- func ResolveOs(recordType uint16, name string) string
- type AddressType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectAddress ¶
func DetectAddress(detector string, addrType AddressType, ifaceNames []string) (string, error)
DetectAddress picks the appropriate IP detection method based on `detector`.
func DetectByInterface ¶
func DetectByInterface(addrType AddressType, ifaceNames []string) (string, error)
DetectByInterface finds the most-likely public IP address as a string, by inspecting addresses assigned to OS network interfaces. If ifaceNames are not empty, it will filter ip addresses based on the associated interface name.
Types ¶
type AddressType ¶
type AddressType int
AddressType denotes the type of IP address.
const ( // IP4 represents IPv4 address. IP4 AddressType = iota // IP6 represents IPv6 address. IP6 AddressType = iota )
func GetAddressType ¶
func GetAddressType(ipAddr net.IP) AddressType
GetAddressType returns the AddressType of the given IP.
Click to show internal directories.
Click to hide internal directories.