Documentation
¶
Overview ¶
Package geo resolves a client IP into country/city (optional, via a MaxMind GeoLite2 mmdb) and parses a User-Agent into device/browser/os.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver looks up geographic info; nil-safe when no database is configured.
func Open ¶
Open loads the mmdb at path. An empty path yields a no-op resolver.
The file is read into memory rather than memory-mapped: geoip2.Open uses mmap, which fails with ENODEV ("no such device") on filesystems that don't support it (some Docker bind mounts / overlay / network volumes). Reading the bytes avoids that and works everywhere.
Click to show internal directories.
Click to hide internal directories.