Documentation
¶
Overview ¶
Package geoip finds the country and city of a reader's address in an operator-supplied MaxMind DB file (GeoLite2-City/Country, DB-IP Lite City/Country; config geoip.database). ReputeCast never downloads the file: the operator puts it in place, keeps it updated and restarts.
Only the derived country code and English city name leave this package; the address itself is never stored for this (internal/tracking).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is a GeoIP database held in memory. The nil DB and a DB that is still loading (or failed to) are off: Lookup finds nothing.
func Load ¶
Load returns at once and opens the file in the background, so a large or corrupt file neither delays start-up nor serves bad data: lookups find nothing until it is verified, and a file that can't be used is logged and stays off. An empty path is off (nil).
func Open ¶
Open reads the file into memory and verifies it. Reading it whole, not memory-mapping it, means replacing the file on disk can't crash a running reader; verifying it means a corrupt or hostile file is refused before any lookup.
func (*DB) Describe ¶
Describe is the database's type and build date ("GeoLite2-City, built 2026-11-04"), or "" when it is off or still loading.