mirror of
https://github.com/SagerNet/sing-geoip.git
synced 2025-02-06 21:12:42 +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 {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var code string
|
// idk why
|
||||||
if country.Country.IsoCode != "" {
|
code := country.RegisteredCountry.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
|
|
||||||
}
|
|
||||||
countryMap[code] = append(countryMap[code], ipNet)
|
countryMap[code] = append(countryMap[code], ipNet)
|
||||||
}
|
}
|
||||||
err = networks.Err()
|
err = networks.Err()
|
||||||
|
Loading…
Reference in New Issue
Block a user