mirror of
https://github.com/therootcompany/golib.git
synced 2026-11-03 22:44:58 +00:00
Add a Go package for reading MaxMind GeoLite2 City and ASN databases.
- ParseConf: parses geoipupdate-style config files (AccountID,
LicenseKey, EditionIDs, DatabaseDirectory)
- Databases: holds open City + ASN readers; Open() loads both
editions from a directory, extracting .mmdb from tar.gz in memory
without writing to disk
- FindTarGz: resolves cache paths, preferring *_LATEST.tar.gz
- Lookup: returns city, region, country, ASN, and AS org for an IP
- DownloadBase constant, TarGzName helper, DefaultConfPaths and
DefaultCacheDir conveniences
Integration tests verify download and conditional-get freshness.
15 lines
318 B
Modula-2
15 lines
318 B
Modula-2
module github.com/therootcompany/golib/net/geoip
|
|
|
|
go 1.26.0
|
|
|
|
require (
|
|
github.com/oschwald/geoip2-golang v1.13.0
|
|
github.com/therootcompany/golib/net/httpcache v0.5.0
|
|
)
|
|
|
|
require (
|
|
github.com/oschwald/maxminddb-golang v1.13.0 // indirect
|
|
golang.org/x/sync v0.20.0 // indirect
|
|
golang.org/x/sys v0.45.0 // indirect
|
|
)
|