refactor(cmd/form2mail): use external GeoIP updater

This commit is contained in:
AJ ONeal 2026-09-09 11:38:30 -06:00
parent 4760eecc38
commit 3d02034c22
No known key found for this signature in database
3 changed files with 3 additions and 9 deletions

View File

@ -60,8 +60,6 @@ type MainConfig struct {
blocklistRepo string blocklistRepo string
cacheDir string cacheDir string
geoipDir string geoipDir string
geoipBaseURL string
geoipConfPath string
} }
func main() { func main() {
@ -93,8 +91,6 @@ func main() {
fs.StringVar(&cfg.blocklistRepo, "blocklist-repo", cfg.blocklistRepo, "git URL of the bitwire-it-compatible blocklist repo") fs.StringVar(&cfg.blocklistRepo, "blocklist-repo", cfg.blocklistRepo, "git URL of the bitwire-it-compatible blocklist repo")
fs.StringVar(&cfg.cacheDir, "cache-dir", "", "cache parent dir (default: ~/.cache)") fs.StringVar(&cfg.cacheDir, "cache-dir", "", "cache parent dir (default: ~/.cache)")
fs.StringVar(&cfg.geoipDir, "geoip-dir", "", "dir holding GeoLite2 tarballs (default: <$cache-dir>/maxmind)") fs.StringVar(&cfg.geoipDir, "geoip-dir", "", "dir holding GeoLite2 tarballs (default: <$cache-dir>/maxmind)")
fs.StringVar(&cfg.geoipBaseURL, "geoip-base-url", "", "MaxMind download base URL (default: https://download.maxmind.com/geoip/databases)")
fs.StringVar(&cfg.geoipConfPath, "geoip-conf", "", "path to GeoIP.conf (default: ./GeoIP.conf or ~/.config/maxmind/GeoIP.conf)")
fs.Usage = func() { fs.Usage = func() {
printVersion(os.Stderr) printVersion(os.Stderr)
@ -188,8 +184,6 @@ func main() {
BlocklistRepo: cfg.blocklistRepo, BlocklistRepo: cfg.blocklistRepo,
CacheDir: cfg.cacheDir, CacheDir: cfg.cacheDir,
GeoIPDir: cfg.geoipDir, GeoIPDir: cfg.geoipDir,
GeoIPBaseURL: cfg.geoipBaseURL,
GeoIPConfPath: cfg.geoipConfPath,
AllowedCountries: []string{"US", "CA", "MX", "CR", "VI"}, AllowedCountries: []string{"US", "CA", "MX", "CR", "VI"},
Fields: fields, Fields: fields,
RPM: requestsPerMinute, RPM: requestsPerMinute,

View File

@ -4,7 +4,7 @@ go 1.26.5
require ( require (
github.com/joho/godotenv v1.5.1 github.com/joho/godotenv v1.5.1
github.com/therootcompany/golib/net/formmailer v0.1.1 github.com/therootcompany/golib/net/formmailer v0.2.0
golang.org/x/term v0.40.0 golang.org/x/term v0.40.0
) )

View File

@ -12,8 +12,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/therootcompany/golib/https v0.9.0 h1:D9gh0K6ljkvF805JUbylITn8SHPMo08q5PglQGXsK8c= github.com/therootcompany/golib/https v0.9.0 h1:D9gh0K6ljkvF805JUbylITn8SHPMo08q5PglQGXsK8c=
github.com/therootcompany/golib/https v0.9.0/go.mod h1:ilExqR/Uh7oB36oy9mwuNhANcFh+zdCfD3uJiZ11YAY= github.com/therootcompany/golib/https v0.9.0/go.mod h1:ilExqR/Uh7oB36oy9mwuNhANcFh+zdCfD3uJiZ11YAY=
github.com/therootcompany/golib/net/formmailer v0.1.1 h1:TF81OYZNqWu6aZqhaEGcKEBaCUSfOvgM+807/Snn+Xo= github.com/therootcompany/golib/net/formmailer v0.2.0 h1:2sfP9YhLKZ6TUJYw8ynOhrzs0sJri+uukBLttr3WWKo=
github.com/therootcompany/golib/net/formmailer v0.1.1/go.mod h1:hFr4I6BalzjJOs5JA7p2iGayN6wTz13/YqEDYOhptDs= github.com/therootcompany/golib/net/formmailer v0.2.0/go.mod h1:hFr4I6BalzjJOs5JA7p2iGayN6wTz13/YqEDYOhptDs=
github.com/therootcompany/golib/net/geoip v0.5.3 h1:wps0TrRoGYw7XA5mWP0uOkGBF5oZ5rQ+1JPIAkRYrOU= github.com/therootcompany/golib/net/geoip v0.5.3 h1:wps0TrRoGYw7XA5mWP0uOkGBF5oZ5rQ+1JPIAkRYrOU=
github.com/therootcompany/golib/net/geoip v0.5.3/go.mod h1:3CuuG2igsZySLNrRxoRTHPw3fmw9c4b0jRajSOOKJNU= github.com/therootcompany/golib/net/geoip v0.5.3/go.mod h1:3CuuG2igsZySLNrRxoRTHPw3fmw9c4b0jRajSOOKJNU=
github.com/therootcompany/golib/net/gitshallow v0.9.3 h1:FKi0IvpqEDnYasjTmkRmXDdi+y3bhQBcjgvggwAwxFs= github.com/therootcompany/golib/net/gitshallow v0.9.3 h1:FKi0IvpqEDnYasjTmkRmXDdi+y3bhQBcjgvggwAwxFs=