mirror of
https://github.com/therootcompany/golib.git
synced 2026-04-24 12:48:00 +00:00
docs: note GeoLite2 free signup in check-ip and geoip.Conf
Missing GeoIP.conf now points users at the free MaxMind signup with an example config. Also documented on the geoip.Conf godoc.
This commit is contained in:
parent
f293f86b16
commit
0c509fb563
@ -52,7 +52,7 @@ func main() {
|
||||
cfg := IPCheck{}
|
||||
fs := flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
|
||||
fs.StringVar(&cfg.Bind, "serve", "", "bind address for the HTTP API, e.g. :8080")
|
||||
fs.StringVar(&cfg.GeoIPConfPath, "geoip-conf", "", "path to GeoIP.conf (default: ./GeoIP.conf or ~/.config/maxmind/GeoIP.conf)")
|
||||
fs.StringVar(&cfg.GeoIPConfPath, "geoip-conf", "", "path to GeoIP.conf with MaxMind AccountID + LicenseKey\n(free signup at https://www.maxmind.com/en/geolite2/signup)\n(default: ./GeoIP.conf or ~/.config/maxmind/GeoIP.conf)")
|
||||
fs.StringVar(&cfg.RepoURL, "blocklist-repo", defaultBlocklistRepo, "git URL of the blocklist repo (must match bitwire-it layout)")
|
||||
fs.StringVar(&cfg.CacheDir, "cache-dir", "", "cache parent dir, holds bitwire-it/ and maxmind/ subdirs (default: OS user cache)")
|
||||
fs.StringVar(&cfg.WhitelistPath, "whitelist", "", "path to a file of IPs and/or CIDRs (one per line) that override block decisions")
|
||||
@ -141,7 +141,14 @@ func main() {
|
||||
// conditional GETs. geoip.Open extracts in-memory — no .mmdb files
|
||||
// are written to disk.
|
||||
if cfg.GeoIPBasicAuth == "" {
|
||||
log.Fatalf("geoip-conf: not found; set --geoip-conf or place GeoIP.conf in a default location")
|
||||
log.Fatalf("geoip-conf: not found; set --geoip-conf or place GeoIP.conf in a default location.\n"+
|
||||
"GeoLite2 registration and the AccountID/LicenseKey needed for GeoIP.conf are free at:\n"+
|
||||
" https://www.maxmind.com/en/geolite2/signup\n"+
|
||||
"Then create a license key and write ./GeoIP.conf (or ~/.config/maxmind/GeoIP.conf):\n"+
|
||||
" AccountID <your-account-id>\n"+
|
||||
" LicenseKey <your-license-key>\n"+
|
||||
" EditionIDs GeoLite2-City GeoLite2-ASN\n"+
|
||||
"Default search paths: %v", geoip.DefaultConfPaths())
|
||||
}
|
||||
maxmindDir := filepath.Join(cfg.CacheDir, "maxmind")
|
||||
authHeader := http.Header{"Authorization": []string{cfg.GeoIPBasicAuth}}
|
||||
|
||||
@ -7,6 +7,14 @@ import (
|
||||
)
|
||||
|
||||
// Conf holds the fields parsed from a geoipupdate-style config file.
|
||||
//
|
||||
// GeoLite2 is free: sign up at https://www.maxmind.com/en/geolite2/signup
|
||||
// to get an AccountID and generate a LicenseKey, then write them to
|
||||
// GeoIP.conf alongside the desired EditionIDs:
|
||||
//
|
||||
// AccountID 123456
|
||||
// LicenseKey xxxxxxxxxxxxxxxx
|
||||
// EditionIDs GeoLite2-City GeoLite2-ASN
|
||||
type Conf struct {
|
||||
AccountID string
|
||||
LicenseKey string
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user