From cb39f30d91fed4f649574c57f51e66b64c19b124 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 20 Apr 2026 16:13:30 -0600 Subject: [PATCH] refactor(geoip,check-ip): inline literal mmdb filenames MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use 'GeoLite2-City.mmdb' / 'GeoLite2-ASN.mmdb' directly instead of composing from the edition constants. Reads plainly — the actual filename is right there. --- cmd/check-ip/main.go | 4 ++-- net/geoip/databases.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/check-ip/main.go b/cmd/check-ip/main.go index 9165b8a..c2d5b10 100644 --- a/cmd/check-ip/main.go +++ b/cmd/check-ip/main.go @@ -134,8 +134,8 @@ func main() { // downloaded via httpcache conditional GETs; otherwise the files are // expected to exist on disk and are polled for out-of-band changes. func geoFetcher(confPath, dir string) dataset.Fetcher { - cityPath := filepath.Join(dir, geoip.CityEdition+".mmdb") - asnPath := filepath.Join(dir, geoip.ASNEdition+".mmdb") + cityPath := filepath.Join(dir, "GeoLite2-City.mmdb") + asnPath := filepath.Join(dir, "GeoLite2-ASN.mmdb") if confPath == "" { for _, p := range geoip.DefaultConfPaths() { if _, err := os.Stat(p); err == nil { diff --git a/net/geoip/databases.go b/net/geoip/databases.go index 4cbf806..2b82237 100644 --- a/net/geoip/databases.go +++ b/net/geoip/databases.go @@ -17,8 +17,8 @@ type Databases struct { // Open opens /GeoLite2-City.mmdb and /GeoLite2-ASN.mmdb. func Open(dir string) (*Databases, error) { - cityPath := filepath.Join(dir, CityEdition+".mmdb") - asnPath := filepath.Join(dir, ASNEdition+".mmdb") + cityPath := filepath.Join(dir, "GeoLite2-City.mmdb") + asnPath := filepath.Join(dir, "GeoLite2-ASN.mmdb") city, err := geoip2.Open(cityPath) if err != nil { return nil, fmt.Errorf("open %s: %w", cityPath, err)