mirror of
https://github.com/mpolden/echoip.git
synced 2025-07-16 14:03:31 +02:00
Differentiate between IsEU being false and unknown
This commit is contained in:
@ -16,7 +16,7 @@ type Reader interface {
|
||||
type Country struct {
|
||||
Name string
|
||||
ISO string
|
||||
IsEU bool
|
||||
IsEU *bool
|
||||
}
|
||||
|
||||
type City struct {
|
||||
@ -70,10 +70,8 @@ func (g *geoip) Country(ip net.IP) (Country, error) {
|
||||
if record.RegisteredCountry.IsoCode != "" && country.ISO == "" {
|
||||
country.ISO = record.RegisteredCountry.IsoCode
|
||||
}
|
||||
country.IsEU = record.Country.IsInEuropeanUnion
|
||||
if record.RegisteredCountry.IsoCode != "" && country.ISO == "" {
|
||||
country.IsEU = record.RegisteredCountry.IsInEuropeanUnion
|
||||
}
|
||||
isEU := record.Country.IsInEuropeanUnion || record.RegisteredCountry.IsInEuropeanUnion
|
||||
country.IsEU = &isEU
|
||||
return country, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user