diff --git a/reader.go b/reader.go index 70980b2..7e9e0a6 100644 --- a/reader.go +++ b/reader.go @@ -70,6 +70,7 @@ type Enterprise struct { AutonomousSystemNumber uint `maxminddb:"autonomous_system_number"` StaticIPScore float64 `maxminddb:"static_ip_score"` IsAnonymousProxy bool `maxminddb:"is_anonymous_proxy"` + IsAnycast bool `maxminddb:"is_anycast"` IsLegitimateProxy bool `maxminddb:"is_legitimate_proxy"` IsSatelliteProvider bool `maxminddb:"is_satellite_provider"` } `maxminddb:"traits"` @@ -130,6 +131,7 @@ type City struct { } `maxminddb:"location"` Traits struct { IsAnonymousProxy bool `maxminddb:"is_anonymous_proxy"` + IsAnycast bool `maxminddb:"is_anycast"` IsSatelliteProvider bool `maxminddb:"is_satellite_provider"` } `maxminddb:"traits"` } @@ -163,6 +165,7 @@ type Country struct { } `maxminddb:"represented_country"` Traits struct { IsAnonymousProxy bool `maxminddb:"is_anonymous_proxy"` + IsAnycast bool `maxminddb:"is_anycast"` IsSatelliteProvider bool `maxminddb:"is_satellite_provider"` } `maxminddb:"traits"` } diff --git a/reader_test.go b/reader_test.go index 606203b..56e0552 100644 --- a/reader_test.go +++ b/reader_test.go @@ -118,6 +118,21 @@ func TestReader(t *testing.T) { assert.False(t, record.RepresentedCountry.IsInEuropeanUnion) } +func TestIsAnycast(t *testing.T) { + for _, test := range []string{"Country", "City", "Enterprise"} { + t.Run(test, func(t *testing.T) { + reader, err := Open("test-data/test-data/GeoIP2-" + test + "-Test.mmdb") + require.NoError(t, err) + defer reader.Close() + + record, err := reader.City(net.ParseIP("214.1.1.0")) + require.NoError(t, err) + + assert.True(t, record.Traits.IsAnycast) + }) + } +} + func TestMetroCode(t *testing.T) { reader, err := Open("test-data/test-data/GeoIP2-City-Test.mmdb") require.NoError(t, err) diff --git a/test-data b/test-data index 3e225a8..0a9c1aa 160000 --- a/test-data +++ b/test-data @@ -1 +1 @@ -Subproject commit 3e225a82e492a58eef738ef2b6e94aa4f50ef932 +Subproject commit 0a9c1aa26cd7b91bee2efe27e7d174797d8211a6