From 4be169b3d397ec121ced6ebe4e62425895989d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Wed, 9 Oct 2024 20:15:19 +0800 Subject: [PATCH] Fix select country --- main.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/main.go b/main.go index 03d785c7e..eb67a08a5 100644 --- a/main.go +++ b/main.go @@ -91,18 +91,8 @@ func parse(binary []byte) (metadata maxminddb.Metadata, countryMap map[string][] if err != nil { return } - var code string - if country.Country.IsoCode != "" { - code = strings.ToLower(country.Country.IsoCode) - } else if country.RegisteredCountry.IsoCode != "" { - code = strings.ToLower(country.RegisteredCountry.IsoCode) - } else if country.RepresentedCountry.IsoCode != "" { - code = strings.ToLower(country.RepresentedCountry.IsoCode) - } else if country.Continent.Code != "" { - code = strings.ToLower(country.Continent.Code) - } else { - continue - } + // idk why + code := country.RegisteredCountry.IsoCode countryMap[code] = append(countryMap[code], ipNet) } err = networks.Err()