mirror of
https://github.com/mpolden/echoip.git
synced 2025-03-14 16:20:07 +01:00
Fall back to registered country
This commit is contained in:
parent
b8ee0c2a5b
commit
6dbeb50677
@ -73,8 +73,11 @@ func (i *Ifconfig) LookupCountry(ip net.IP) (string, error) {
|
||||
}
|
||||
country, exists := record.Country.Names["en"]
|
||||
if !exists {
|
||||
return "", fmt.Errorf("no localized name for country: %+v",
|
||||
record)
|
||||
country, exists = record.RegisteredCountry.Names["en"]
|
||||
if !exists {
|
||||
return "", fmt.Errorf(
|
||||
"could not determine country for IP: %s", ip)
|
||||
}
|
||||
}
|
||||
return country, nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user