Documentation
¶
Index ¶
Constants ¶
View Source
const ( MaxmindCityDBEnv = "MAXMIND_CITY_DB" MaxmindASNDBEnv = "MAXMIND_ASN_DB" )
Variables ¶
This section is empty.
Functions ¶
func PrintASNDetails ¶
func PrintASNDetails(asn *ASN)
func PrintCityDetails ¶
func PrintCityDetails(city *City)
displayCityName returns the city name to display, which is the city name if it is available, otherwise it falls back to the locality name, and if that is not available it returns an empty string.
Types ¶
type ASN ¶
type City ¶
type City struct {
City struct {
GeoNameID uint32 `maxminddb:"geoname_id"`
Names map[string]string `maxminddb:"names"`
} `maxminddb:"city"`
Continent struct {
Code string `maxminddb:"code"`
GeoNameID uint32 `maxminddb:"geoname_id"`
Names map[string]string `maxminddb:"names"`
} `maxminddb:"continent"`
Country struct {
GeoNameID uint32 `maxminddb:"geoname_id"`
ISOCode string `maxminddb:"iso_code"`
IsInEuropeanUnion bool `maxminddb:"is_in_european_union"`
Names map[string]string `maxminddb:"names"`
} `maxminddb:"country"`
Location struct {
AccuracyRadius uint16 `maxminddb:"accuracy_radius"`
Latitude float64 `maxminddb:"latitude"`
Longitude float64 `maxminddb:"longitude"`
MetroCode uint `maxminddb:"metro_code"`
TimeZone string `maxminddb:"time_zone"`
} `maxminddb:"location"`
Postal struct {
Code string `maxminddb:"code"`
} `maxminddb:"postal"`
RegisteredCountry struct {
GeoNameID uint32 `maxminddb:"geoname_id"`
ISOCode string `maxminddb:"iso_code"`
IsInEuropeanUnion bool `maxminddb:"is_in_european_union"`
Names map[string]string `maxminddb:"names"`
} `maxminddb:"registered_country"`
RepresentedCountry struct {
GeoNameID uint32 `maxminddb:"geoname_id"`
ISOCode string `maxminddb:"iso_code"`
IsInEuropeanUnion bool `maxminddb:"is_in_european_union"`
Names map[string]string `maxminddb:"names"`
Type string `maxminddb:"type"`
} `maxminddb:"represented_country"`
Subdivisions []struct {
GeoNameID uint32 `maxminddb:"geoname_id"`
ISOCode string `maxminddb:"iso_code"`
Names map[string]string `maxminddb:"names"`
} `maxminddb:"subdivisions"`
}
func GetCityFromIP ¶
Click to show internal directories.
Click to hide internal directories.