Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Location ¶
type Location struct { CountryCode string `json:"countryCode"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` }
A Location represents an ISO 3166-1 A-2 country codes and an approximate latitude/longitude.
type Locator ¶
type Locator interface { // Close closes the Locator. Close() error // Locate maps IP addresses to a Location. Locate(ip *net.IPAddr) (Location, error) }
A Locator maps IP addresses to their location. It is assumed that it implementations are thread-safe.
func NewMaxMindLocator ¶
NewMaxMindLocator returns a Locator that uses an underlying MaxMind database. If no path is provided, a default embedded GeoLite2-City database is used.
Click to show internal directories.
Click to hide internal directories.