Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate IP Risk database #351

Merged
merged 1 commit into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
CHANGELOG
=========

4.2.0
------------------

* The GeoIP2 IP Risk database has been discontinued. Methods and classes
related to it have been deprecated.

4.1.0 (2023-07-28)
------------------

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/maxmind/geoip2/DatabaseProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ Optional<AnonymousIpResponse> tryAnonymousIp(InetAddress ipAddress) throws IOExc
* Look up an IP address in a GeoIP2 IP Risk database.
*
* @param ipAddress IPv4 or IPv6 address to lookup.
* @return an IPRiskResponse for the requested IP address.
* @return an IpRiskResponse for the requested IP address.
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
* @throws java.io.IOException if there is an IO error
* @deprecated This database has been discontinued.
*/
@Deprecated
IpRiskResponse ipRisk(InetAddress ipAddress) throws IOException,
GeoIp2Exception;

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/maxmind/geoip2/DatabaseReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,9 @@ private Optional<AnonymousIpResponse> getAnonymousIp(
* @return a IPRiskResponse for the requested IP address.
* @throws GeoIp2Exception if there is an error looking up the IP
* @throws IOException if there is an IO error
* @deprecated This database has been discontinued.
*/
@Deprecated
@Override
public IpRiskResponse ipRisk(InetAddress ipAddress) throws IOException,
GeoIp2Exception {
Expand All @@ -446,6 +448,7 @@ public IpRiskResponse ipRisk(InetAddress ipAddress) throws IOException,
return r.get();
}

@Deprecated
@Override
public Optional<IpRiskResponse> tryIpRisk(InetAddress ipAddress) throws IOException,
GeoIp2Exception {
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/maxmind/geoip2/model/IpRiskResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

/**
* This class provides the GeoIP2 IP Risk model.
*
* @deprecated This database has been discontinued.
*/
@Deprecated
public class IpRiskResponse extends IpBaseResponse {

private final double ipRisk;
Expand Down
23 changes: 0 additions & 23 deletions src/test/java/com/maxmind/geoip2/DatabaseReaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import com.maxmind.geoip2.model.CountryResponse;
import com.maxmind.geoip2.model.DomainResponse;
import com.maxmind.geoip2.model.EnterpriseResponse;
import com.maxmind.geoip2.model.IpRiskResponse;
import com.maxmind.geoip2.model.IspResponse;
import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -228,28 +227,6 @@ public void testAnonymousIp() throws Exception {
}
}

@Test
public void testIPRisk() throws Exception {
try (DatabaseReader reader = new DatabaseReader.Builder(
this.getFile("GeoIP2-IP-Risk-Test.mmdb")).build()
) {
InetAddress ipAddress =
InetAddress.getByName("0000:0000:0000:0000:0000:0000:D602:0300");
IpRiskResponse response = reader.ipRisk(ipAddress);
assertTrue(response.isAnonymous());
assertTrue(response.isAnonymousVpn());
assertFalse(response.isHostingProvider());
assertFalse(response.isPublicProxy());
assertFalse(response.isResidentialProxy());
assertFalse(response.isTorExitNode());
assertEquals(ipAddress.getHostAddress(), response.getIpAddress());
assertEquals(0.1, response.getIpRisk(), 0.0001);
assertEquals("0:0:0:0:0:0:d602:300/126", response.getNetwork().toString());
IpRiskResponse tryResponse = reader.tryIpRisk(ipAddress).get();
assertEquals(response.toJson(), tryResponse.toJson());
}
}

@Test
public void testAnonymousIpIsResidentialProxy() throws Exception {
try (DatabaseReader reader = new DatabaseReader.Builder(
Expand Down
Loading