Permalink
Browse files

Merge pull request #100 from maxmind/greg/anonymizer

Add new anonymizer outputs for Insights
  • Loading branch information...
oalders committed Oct 26, 2017
2 parents 35d7a46 + dcb18e2 commit 9f89a48d94dbad116165c2528ae6bb7a5e374c49
Showing with 55 additions and 6 deletions.
  1. +7 −0 CHANGELOG.md
  2. +21 −2 src/Record/Traits.php
  3. +27 −4 tests/GeoIp2/Test/Model/InsightsTest.php
View
@@ -1,6 +1,13 @@
CHANGELOG
=========
2.7.0 (2017-XX-XX)
------------------
* The following new anonymizer properties were added to `GeoIp2\Record\Traits`
for use with GeoIP2 Precision Insights: `isAnonymous`, `isAnonymousVpn`,
`isHostingProvider`, `isPublicProxy`, and `isTorExitNode`.
2.6.0 (2017-07-10)
-----------------
View
@@ -32,18 +32,32 @@
* running on. If the system is behind a NAT, this may differ from the IP
* address locally assigned to it. This attribute is returned by all end
* points.
* @property-read bool $isAnonymous This is true if the IP address belongs to
* any sort of anonymous network. This property is only available from GeoIP2
* Precision Insights.
* @property-read bool $isAnonymousProxy *Deprecated.* Please see our
* {@link * https://www.maxmind.com/en/geoip2-anonymous-ip-database GeoIP2
* Anonymous IP database} to determine whether the IP address is used by an
* anonymizing service.
* @property-read bool $isAnonymousVpn This is true if the IP address belongs to
* an anonymous VPN system. This property is only available from GeoIP2
* Precision Insights.
* @property-read bool $isHostingProvider This is true if the IP address belongs
* to a hosting provider. This property is only available from GeoIP2
* Precision Insights.
* @property-read bool $isLegitimateProxy This attribute is true if MaxMind
* believes this IP address to be a legitimate proxy, such as an internal
* VPN used by a corporation. This attribute is only available in the GeoIP2
* Enterprise database.
* @property-read bool $isPublicProxy This is true if the IP address belongs to
* a public proxy. This property is only available from GeoIP2 Precision
* Insights.
* @property-read bool $isSatelliteProvider *Deprecated.* Due to the
* increased coverage by mobile carriers, very few satellite providers now
* serve multiple countries. As a result, the output does not provide
* sufficiently relevant data for us to maintain it.
* @property-read bool $isTorExitNode This is true if the IP address is a Tor
* exit node. This property is only available from GeoIP2 Precision Insights.
* @property-read string|null $isp The name of the ISP associated with the IP
* address. This attribute is only available from the City and Insights web
* services and the GeoIP2 Enterprise database.
@@ -84,11 +98,16 @@ class Traits extends AbstractRecord
'autonomousSystemOrganization',
'connectionType',
'domain',
'ipAddress',
'isAnonymous',
'isAnonymousProxy',
'isAnonymousVpn',
'isHostingProvider',
'isLegitimateProxy',
'isSatelliteProvider',
'isp',
'ipAddress',
'isPublicProxy',
'isSatelliteProvider',
'isTorExitNode',
'organization',
'userType',
];
@@ -65,7 +65,12 @@ public function testFull()
'autonomous_system_organization' => 'AS Organization',
'domain' => 'example.com',
'ip_address' => '1.2.3.4',
'is_anonymous' => true,
'is_anonymous_vpn' => true,
'is_hosting_provider' => true,
'is_public_proxy' => true,
'is_satellite_provider' => true,
'is_tor_exit_node' => true,
'isp' => 'Comcast',
'organization' => 'Blorg',
'user_type' => 'college',
@@ -145,14 +150,32 @@ public function testFull()
'$model->traits'
);
$this->assertSame(
true,
$this->assertTrue(
$model->traits->isAnonymous,
'$model->traits->isAnonymous is true'
);
$this->assertTrue(
$model->traits->isHostingProvider,
'$model->traits->isHostingProvider is true'
);
$this->assertTrue(
$model->traits->isPublicProxy,
'$model->traits->isPublicProxy is true'
);
$this->assertTrue(
$model->traits->isSatelliteProvider,
'$model->traits->isSatelliteProvider is true'
);
$this->assertSame(
false,
$this->assertTrue(
$model->traits->isTorExitNode,
'$model->traits->isTorExitNode is true'
);
$this->assertFalse(
$model->traits->isAnonymousProxy,
'$model->traits->isAnonymousProxy is false'
);

0 comments on commit 9f89a48

Please sign in to comment.