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.
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).
type Geolocator ¶
A Geolocator is able to geolocate IPs, using a specific http.Client.
func NewDefaultGeolocator ¶
func NewDefaultGeolocator() *Geolocator
func NewGeolocator ¶
func NewGeolocator(apiUrl string) *Geolocator
func (*Geolocator) FindCurrentHostGeolocationWithSTUN ¶
func (g *Geolocator) FindCurrentHostGeolocationWithSTUN(stunServers []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
func (*Geolocator) Geolocate ¶
func (g *Geolocator) Geolocate(ip string) (*GeoInfo, error)
Source Files
¶
- doc.go
- geolocate.go
- https.go
- stun.go