diff options
author | Martin Polden <mpolden@mpolden.no> | 2018-08-31 23:41:16 +0300 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2018-08-31 23:55:09 +0300 |
commit | 8433521b3b55b33600529ed0ccef748d875340b6 (patch) | |
tree | f47d7530a8089e2192f5fe0cdf86888de9e8ac2f /iputil | |
parent | 7f538ca24b431c986e900576285dcc2229ec701e (diff) |
Differentiate between IsEU being false and unknown
Diffstat (limited to 'iputil')
-rw-r--r-- | iputil/geo/geo.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/iputil/geo/geo.go b/iputil/geo/geo.go index 5509c2f..e87b42f 100644 --- a/iputil/geo/geo.go +++ b/iputil/geo/geo.go @@ -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 } |