modulepackage
0.0.0-20241129152027-2fc88c10f91e
Repository: https://github.com/getlantern/geo.git
Documentation: pkg.go.dev
# README
geo
Looks up geoinfo from MaxMind GeoLite2 Database fetched from web. Currently only country code is supported but later can be extend to city, ISP, etc.
Example:
// Keep in sync with the database from geolite2_url every day, without
// keeping a local copy in disk.
lookup = geo.New(geolite2_url, 24*time.Hour, "")
// or local copy so it's available immediately when the service restarts.
lookup = geo.New(geolite2_url, 24*time.Hour, "local-file-path")
country = lookup.CountryCode(net.ParseIP("1.1.1.1"))
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
FromFile uses the local database file for lookup.
FromWeb is same as New but allows downloading a different MaxMind database lookupForValidation is a function that we call to validate new databases as they're loaded.
No description provided by the author
No description provided by the author
LatLongFromWeb is same as New but allows downloading a different MaxMind database for lat/long lookup lookupForValidation is a function that we call to validate new databases as they're loaded.
New constructs a new Lookup from the MaxMind GeoLite2 Country database fetched from the given URL and keeps in sync with it every syncInterval.
# Interfaces
No description provided by the author
CountryLookup allows looking up the country for an IP address.
ISPLookup allows looking up ISP information for an IP address.
No description provided by the author
No description provided by the author