Skip to content

Commit f071b8a

Browse files
committed
Add support for is_residential_proxy
1 parent e8873e1 commit f071b8a

File tree

6 files changed

+39
-1
lines changed

6 files changed

+39
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
2.11.0
5+
-------------------
6+
7+
* Added the `isResidentialProxy` property to `GeoIp2\Model\AnonymousIP` and
8+
`GeoIp2\Record\Traits`.
9+
410
2.10.0 (2019-12-12)
511
-------------------
612

maxmind-db

Submodule maxmind-db updated 44 files

src/Model/AnonymousIp.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* to a hosting or VPN provider (see description of isAnonymousVpn property).
1818
* @property-read bool $isPublicProxy This is true if the IP address belongs to
1919
* a public proxy.
20+
* @property-read bool $isResidentialProxy This is true if the IP address is
21+
* on a suspected anonymizing network and belongs to a residential ISP.
2022
* @property-read bool $isTorExitNode This is true if the IP address is a Tor
2123
* exit node.
2224
* @property-read string $ipAddress The IP address that the data in the model is
@@ -31,6 +33,7 @@ class AnonymousIp extends AbstractModel
3133
protected $isAnonymousVpn;
3234
protected $isHostingProvider;
3335
protected $isPublicProxy;
36+
protected $isResidentialProxy;
3437
protected $isTorExitNode;
3538
protected $ipAddress;
3639
protected $network;
@@ -48,6 +51,7 @@ public function __construct($raw)
4851
$this->isAnonymousVpn = $this->get('is_anonymous_vpn');
4952
$this->isHostingProvider = $this->get('is_hosting_provider');
5053
$this->isPublicProxy = $this->get('is_public_proxy');
54+
$this->isResidentialProxy = $this->get('is_residential_proxy');
5155
$this->isTorExitNode = $this->get('is_tor_exit_node');
5256
$ipAddress = $this->get('ip_address');
5357
$this->ipAddress = $ipAddress;

src/Record/Traits.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@
5656
* @property-read bool $isPublicProxy This is true if the IP address belongs to
5757
* a public proxy. This property is only available from GeoIP2 Precision
5858
* Insights.
59+
* @property-read bool $isResidentialProxy This is true if the IP address is
60+
* on a suspected anonymizing network and belongs to a residential ISP. This
61+
* property is only available from GeoIP2 Precision Insights.
5962
* @property-read bool $isSatelliteProvider *Deprecated.* Due to the
6063
* increased coverage by mobile carriers, very few satellite providers now
6164
* serve multiple countries. As a result, the output does not provide
@@ -120,6 +123,7 @@ class Traits extends AbstractRecord
120123
'isLegitimateProxy',
121124
'isp',
122125
'isPublicProxy',
126+
'isResidentialProxy',
123127
'isSatelliteProvider',
124128
'isTorExitNode',
125129
'network',

tests/GeoIp2/Test/Database/ReaderTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,30 @@ public function testAnonymousIp()
136136
$this->assertTrue($record->isAnonymousVpn);
137137
$this->assertFalse($record->isHostingProvider);
138138
$this->assertFalse($record->isPublicProxy);
139+
$this->assertFalse($record->isResidentialProxy);
139140
$this->assertFalse($record->isTorExitNode);
140141
$this->assertSame($ipAddress, $record->ipAddress);
141142
$this->assertSame('1.2.0.0/16', $record->network);
142143
$reader->close();
143144
}
144145

146+
public function testAnonymousIpAllTrue()
147+
{
148+
$reader = new Reader('maxmind-db/test-data/GeoIP2-Anonymous-IP-Test.mmdb');
149+
$ipAddress = '81.2.69.1';
150+
151+
$record = $reader->anonymousIp($ipAddress);
152+
$this->assertTrue($record->isAnonymous);
153+
$this->assertTrue($record->isAnonymousVpn);
154+
$this->assertTrue($record->isHostingProvider);
155+
$this->assertTrue($record->isPublicProxy);
156+
$this->assertTrue($record->isResidentialProxy);
157+
$this->assertTrue($record->isTorExitNode);
158+
$this->assertSame($ipAddress, $record->ipAddress);
159+
$this->assertSame('81.2.69.0/24', $record->network);
160+
$reader->close();
161+
}
162+
145163
public function testAsn()
146164
{
147165
$reader = new Reader('maxmind-db/test-data/GeoLite2-ASN-Test.mmdb');

tests/GeoIp2/Test/Model/InsightsTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public function testFull()
7070
'is_anonymous_vpn' => true,
7171
'is_hosting_provider' => true,
7272
'is_public_proxy' => true,
73+
'is_residential_proxy' => true,
7374
'is_satellite_provider' => true,
7475
'is_tor_exit_node' => true,
7576
'isp' => 'Comcast',
@@ -168,6 +169,11 @@ public function testFull()
168169
'$model->traits->isPublicProxy is true'
169170
);
170171

172+
$this->assertTrue(
173+
$model->traits->isResidentialProxy,
174+
'$model->traits->isResidentialProxy is true'
175+
);
176+
171177
$this->assertTrue(
172178
$model->traits->isSatelliteProvider,
173179
'$model->traits->isSatelliteProvider is true'

0 commit comments

Comments
 (0)