Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ASOrgUnknown ¶ added in v0.7.19
ASOrgUnknown return whether the given AS Org string actually is meant to mean that the AS Org is unknown.
func IsInitialized ¶ added in v0.9.0
IsInitialized returns whether the geoip database has been initialized.
Types ¶
type Coordinates ¶ added in v0.7.1
type Coordinates struct { AccuracyRadius uint16 `maxminddb:"accuracy_radius"` Latitude float64 `maxminddb:"latitude"` Longitude float64 `maxminddb:"longitude"` }
Coordinates holds geographic coordinates and their estimated accuracy.
type CountryInfo ¶ added in v1.4.4
type CountryInfo struct { ID string Name string Region string ContinentCode string Center Coordinates }
CountryInfo holds additional information about countries.
func GetCountryInfo ¶ added in v1.4.4
func GetCountryInfo(countryCode string) *CountryInfo
GetCountryInfo returns the country info of the given country code, or nil in case the data does not exist.
type Location ¶
type Location struct { Continent struct { Code string `maxminddb:"code"` } `maxminddb:"continent"` Country struct { Name string ISOCode string `maxminddb:"iso_code"` } `maxminddb:"country"` Coordinates Coordinates `maxminddb:"location"` AutonomousSystemNumber uint `maxminddb:"autonomous_system_number"` AutonomousSystemOrganization string `maxminddb:"autonomous_system_organization"` IsAnycast bool `maxminddb:"is_anycast"` IsSatelliteProvider bool `maxminddb:"is_satellite_provider"` IsAnonymousProxy bool `maxminddb:"is_anonymous_proxy"` }
Location holds information regarding the geographical and network location of an IP address. TODO: We are currently re-using the Continent-Code for the region. Update this and all dependencies.
func GetLocation ¶
GetLocation returns Location data of an IP address.
func (*Location) AddCountryInfo ¶ added in v1.4.4
func (l *Location) AddCountryInfo()
AddCountryInfo adds missing country information to the location.
func (*Location) EstimateNetworkProximity ¶
EstimateNetworkProximity aims to calculate the distance between two network locations. Returns a proximity value between 0 (far away) and 100 (nearby).
func (*Location) IsRegionalNeighbor ¶ added in v1.0.10
IsRegionalNeighbor returns whether the supplied location is a regional neighbor.