mirror of
https://github.com/SagerNet/sing-geoip.git
synced 2025-02-06 13:02:43 +08:00
Fix select country
This commit is contained in:
parent
d4fc531179
commit
4be169b3d3
14
main.go
14
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()
|
||||
|
Loading…
Reference in New Issue
Block a user