Differentiate between IsEU being false and unknown

This commit is contained in:
Martin Polden
2018-08-31 22:41:16 +02:00
parent 7f538ca24b
commit 8433521b3b
3 changed files with 6 additions and 8 deletions

View File

@ -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
}