Files
nixpkgs/pkgs/by-name/ne/nezha/dbip.patch
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

37 lines
1.0 KiB
Diff

diff --git a/pkg/geoip/geoip.go b/pkg/geoip/geoip.go
index 6d913b9..13be7f5 100644
--- a/pkg/geoip/geoip.go
+++ b/pkg/geoip/geoip.go
@@ -19,10 +19,12 @@ var (
)
type IPInfo struct {
- Country string `maxminddb:"country"`
- CountryName string `maxminddb:"country_name"`
- Continent string `maxminddb:"continent"`
- ContinentName string `maxminddb:"continent_name"`
+ Country struct {
+ IsoCode string `maxminddb:"iso_code"`
+ } `maxminddb:"country"`
+ Continent struct {
+ Code string `maxminddb:"code"`
+ } `maxminddb:"continent"`
}
func init() {
@@ -44,10 +46,10 @@ func Lookup(ip net.IP, record *IPInfo) (string, error) {
return "", err
}
- if record.Country != "" {
- return strings.ToLower(record.Country), nil
- } else if record.Continent != "" {
- return strings.ToLower(record.Continent), nil
+ if record.Country.IsoCode != "" {
+ return strings.ToLower(record.Country.IsoCode), nil
+ } else if record.Continent.Code != "" {
+ return strings.ToLower(record.Continent.Code), nil
}
return "", fmt.Errorf("IP not found")