Skip to content

Commit

Permalink
Fix select country
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Oct 9, 2024
1 parent d4fc531 commit 4be169b
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 4be169b

Please sign in to comment.