Documentation
¶
Overview ¶
Package ipfinder provides functions for finding your local and public IP addresses.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultPublicIPAPIs = []string{
"https://api.ipify.org/",
"https://ip.seeip.org/",
}
DefaultPublicIPAPIs are the default URLs used to find your public IP. These have almost guaranteed uptime, and no usage limit.
Functions ¶
func FindPublicIP ¶
FindPublicIP queries the given API URLs for your public IP, and returns the first to respond. If no URLs are given, it uses the ones in DefaultPublicIPAPIs. It expects the given APIs to return an IP only, in plain-text.
It errors if all API calls fail, or if the given context cancels before a result is received.
Types ¶
type LocalIP ¶ added in v0.2.0
func FindLocalIPs ¶
FindLocalIPs goes through network interfaces on your computer to find your local IP addresses. It returns a list of the found addresses, along with their associated network interface.