Documentation ¶
Overview ¶
Package geolocate has utils to obtain geolocate metadata about the vantage point.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AttemptFetchingPublicIP ¶
AttemptFetchingPublicIP will attempt to get our public IP by exhausting all the available sources; the order is stun > https. It will return an error if all the sources are used and we still don't have a result.
func FetchIPFromHTTPSAPICall ¶
FetchIPFromHTTPSAPICall tries to get the public IP via the passed HTTPS provider label.
func FetchIPFromSTUNCall ¶
FetchIPFromSTUNCall tries to get our public IP using the passed stun uri. It returns an error of the operation does not succeed.
Types ¶
type GeoInfo ¶
GeoInfo contains the minimal metadata that we need for annotating reports.
func FindCurrentHostGeolocation ¶
FindCurrentHostGeolocation will make a best-effor attempt at discovering the public IP of the vantage point where the software is running, and obtain geolocation metadata for it. This function currently uses a single endpoint for geolocation (in the OONI API).
func FindCurrentHostGeolocationWithSTUN ¶
func FindCurrentHostGeolocationWithSTUN(stunServers []string, countryCodeLookupURL string) (*GeoInfo, error)
FindCurrentHostGeolocationWithSTUN first trys to get the current public ip address by using the given STUN servers. It then uses countryCodeLookupURL to convert the ip address into a country code. If countryCodeLookupURL is empty, then defaultGeolocationAPI (OONI) is used
type Geolocator ¶
A Geolocator is able to geolocate IPs, using a specific http.Client.