Skip to content

Commit aeca9e3

Browse files
oschwaldclaude
andcommitted
Remove deprecated Traits constructors and methods
* Remove deprecated constructors that accepted additional parameters * Remove deprecated methods isAnonymousProxy() and isSatelliteProvider() * Remove associated private fields and parameter documentation * Update copy constructor to work without removed fields Use the GeoIP2 Anonymous IP database for anonymous proxy detection instead. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 9cf35b5 commit aeca9e3

File tree

7 files changed

+7
-217
lines changed

7 files changed

+7
-217
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ CHANGELOG
1414
removed along with the `Closeable` interface implementation.
1515
* **BREAKING:** The deprecated `getUrl()` methods in `HttpException` and
1616
`InvalidRequestException` have been removed. Use `getUri()` instead.
17+
* **BREAKING:** The deprecated `Traits` constructors and methods
18+
`isAnonymousProxy()` and `isSatelliteProvider()` have been removed. Use the
19+
GeoIP2 Anonymous IP database for anonymous proxy detection instead.
1720

1821
4.4.0
1922
------------------

src/main/java/com/maxmind/geoip2/record/Traits.java

Lines changed: 4 additions & 195 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,12 @@ public final class Traits extends AbstractRecord {
2222
private final String domain;
2323
private final String ipAddress;
2424
private final boolean isAnonymous;
25-
private final boolean isAnonymousProxy;
2625
private final boolean isAnonymousVpn;
2726
private final boolean isAnycast;
2827
private final boolean isHostingProvider;
2928
private final boolean isLegitimateProxy;
3029
private final boolean isPublicProxy;
3130
private final boolean isResidentialProxy;
32-
private final boolean isSatelliteProvider;
3331
private final boolean isTorExitNode;
3432
private final String isp;
3533
private final String mobileCountryCode;
@@ -45,8 +43,8 @@ public final class Traits extends AbstractRecord {
4543
*/
4644
public Traits() {
4745
this(null, null, null, null,
48-
null, false, false, false, false, false,
49-
false, false, false, false, false, null,
46+
null, false, false, false, false,
47+
false, false, false, false, null,
5048
null, null, null, null, null, null, null);
5149
}
5250

@@ -58,8 +56,8 @@ public Traits() {
5856
*/
5957
public Traits(String ipAddress, Network network) {
6058
this(null, null, null, null,
61-
ipAddress, false, false, false, false, false,
62-
false, false, false, false, false, null,
59+
ipAddress, false, false, false, false,
60+
false, false, false, false, null,
6361
null, null, network, null, null, null, null);
6462
}
6563

@@ -72,14 +70,12 @@ public Traits(String ipAddress, Network network) {
7270
* @param domain the domain
7371
* @param ipAddress the IP address
7472
* @param isAnonymous the anonymous flag
75-
* @param isAnonymousProxy the anonymous proxy flag
7673
* @param isAnonymousVpn the anonymous VPN flag
7774
* @param isAnycast the anycast flag
7875
* @param isHostingProvider the hosting provider flag
7976
* @param isLegitimateProxy the legitimate proxy flag
8077
* @param isPublicProxy the public proxy flag
8178
* @param isResidentialProxy the residential proxy flag
82-
* @param isSatelliteProvider the satellite provider flag
8379
* @param isTorExitNode the Tor exit node flag
8480
* @param isp the ISP
8581
* @param mobileCountryCode the mobile country code
@@ -97,14 +93,12 @@ public Traits(
9793
@JsonProperty("domain") String domain,
9894
@JacksonInject("ip_address") @JsonProperty("ip_address") String ipAddress,
9995
@JsonProperty("is_anonymous") boolean isAnonymous,
100-
@JsonProperty("is_anonymous_proxy") boolean isAnonymousProxy,
10196
@JsonProperty("is_anonymous_vpn") boolean isAnonymousVpn,
10297
@JsonProperty("is_anycast") boolean isAnycast,
10398
@JsonProperty("is_hosting_provider") boolean isHostingProvider,
10499
@JsonProperty("is_legitimate_proxy") boolean isLegitimateProxy,
105100
@JsonProperty("is_public_proxy") boolean isPublicProxy,
106101
@JsonProperty("is_residential_proxy") boolean isResidentialProxy,
107-
@JsonProperty("is_satellite_provider") boolean isSatelliteProvider,
108102
@JsonProperty("is_tor_exit_node") boolean isTorExitNode,
109103
@JsonProperty("isp") String isp,
110104
@JsonProperty("mobile_country_code") String mobileCountryCode,
@@ -122,14 +116,12 @@ public Traits(
122116
this.domain = domain;
123117
this.ipAddress = ipAddress;
124118
this.isAnonymous = isAnonymous;
125-
this.isAnonymousProxy = isAnonymousProxy;
126119
this.isAnonymousVpn = isAnonymousVpn;
127120
this.isAnycast = isAnycast;
128121
this.isHostingProvider = isHostingProvider;
129122
this.isLegitimateProxy = isLegitimateProxy;
130123
this.isPublicProxy = isPublicProxy;
131124
this.isResidentialProxy = isResidentialProxy;
132-
this.isSatelliteProvider = isSatelliteProvider;
133125
this.isTorExitNode = isTorExitNode;
134126
this.isp = isp;
135127
this.mobileCountryCode = mobileCountryCode;
@@ -150,14 +142,12 @@ public Traits(
150142
* @param domain the domain
151143
* @param ipAddress the IP address
152144
* @param isAnonymous the anonymous flag
153-
* @param isAnonymousProxy the anonymous proxy flag
154145
* @param isAnonymousVpn the anonymous VPN flag
155146
* @param isAnycast the anycast flag
156147
* @param isHostingProvider the hosting provider flag
157148
* @param isLegitimateProxy the legitimate proxy flag
158149
* @param isPublicProxy the public proxy flag
159150
* @param isResidentialProxy the residential proxy flag
160-
* @param isSatelliteProvider the satellite provider flag
161151
* @param isTorExitNode the Tor exit node flag
162152
* @param isp the ISP
163153
* @param mobileCountryCode the mobile country code
@@ -177,14 +167,12 @@ public Traits(
177167
@MaxMindDbParameter(name = "domain") String domain,
178168
@MaxMindDbParameter(name = "ip_address") String ipAddress,
179169
@MaxMindDbParameter(name = "is_anonymous") Boolean isAnonymous,
180-
@MaxMindDbParameter(name = "is_anonymous_proxy") Boolean isAnonymousProxy,
181170
@MaxMindDbParameter(name = "is_anonymous_vpn") Boolean isAnonymousVpn,
182171
@MaxMindDbParameter(name = "is_anycast") Boolean isAnycast,
183172
@MaxMindDbParameter(name = "is_hosting_provider") Boolean isHostingProvider,
184173
@MaxMindDbParameter(name = "is_legitimate_proxy") Boolean isLegitimateProxy,
185174
@MaxMindDbParameter(name = "is_public_proxy") Boolean isPublicProxy,
186175
@MaxMindDbParameter(name = "is_residential_proxy") Boolean isResidentialProxy,
187-
@MaxMindDbParameter(name = "is_satellite_provider") Boolean isSatelliteProvider,
188176
@MaxMindDbParameter(name = "is_tor_exit_node") Boolean isTorExitNode,
189177
@MaxMindDbParameter(name = "isp") String isp,
190178
@MaxMindDbParameter(name = "mobile_country_code") String mobileCountryCode,
@@ -201,14 +189,12 @@ public Traits(
201189
this.domain = domain;
202190
this.ipAddress = ipAddress;
203191
this.isAnonymous = isAnonymous != null ? isAnonymous : false;
204-
this.isAnonymousProxy = isAnonymousProxy != null ? isAnonymousProxy : false;
205192
this.isAnonymousVpn = isAnonymousVpn != null ? isAnonymousVpn : false;
206193
this.isAnycast = isAnycast != null ? isAnycast : false;
207194
this.isHostingProvider = isHostingProvider != null ? isHostingProvider : false;
208195
this.isLegitimateProxy = isLegitimateProxy != null ? isLegitimateProxy : false;
209196
this.isPublicProxy = isPublicProxy != null ? isPublicProxy : false;
210197
this.isResidentialProxy = isResidentialProxy != null ? isResidentialProxy : false;
211-
this.isSatelliteProvider = isSatelliteProvider != null ? isSatelliteProvider : false;
212198
this.isTorExitNode = isTorExitNode != null ? isTorExitNode : false;
213199
this.isp = isp;
214200
this.mobileCountryCode = mobileCountryCode;
@@ -220,161 +206,7 @@ public Traits(
220206
this.staticIpScore = staticIpScore;
221207
}
222208

223-
/**
224-
* @deprecated will be removed in the next major version.
225-
*
226-
* @param autonomousSystemNumber the autonomous system number
227-
* @param autonomousSystemOrganization the autonomous system organization
228-
* @param connectionType the connection type
229-
* @param domain the domain
230-
* @param ipAddress the IP address
231-
* @param isAnonymous the anonymous flag
232-
* @param isAnonymousProxy the anonymous proxy flag
233-
* @param isAnonymousVpn the anonymous VPN flag
234-
* @param isHostingProvider the hosting provider flag
235-
* @param isLegitimateProxy the legitimate proxy flag
236-
* @param isPublicProxy the public proxy flag
237-
* @param isResidentialProxy the residential proxy flag
238-
* @param isSatelliteProvider the satellite provider flag
239-
* @param isTorExitNode the Tor exit node flag
240-
* @param isp the ISP
241-
* @param mobileCountryCode the mobile country code
242-
* @param mobileNetworkCode the mobile network code
243-
* @param network the network
244-
* @param organization the organization
245-
* @param userType the user type
246-
* @param userCount the user count
247-
* @param staticIpScore the static IP score
248-
*/
249-
@Deprecated
250-
public Traits(
251-
Long autonomousSystemNumber,
252-
String autonomousSystemOrganization,
253-
ConnectionType connectionType,
254-
String domain,
255-
String ipAddress,
256-
boolean isAnonymous,
257-
boolean isAnonymousProxy,
258-
boolean isAnonymousVpn,
259-
boolean isHostingProvider,
260-
boolean isLegitimateProxy,
261-
boolean isPublicProxy,
262-
boolean isResidentialProxy,
263-
boolean isSatelliteProvider,
264-
boolean isTorExitNode,
265-
String isp,
266-
String mobileCountryCode,
267-
String mobileNetworkCode,
268-
Network network,
269-
String organization,
270-
String userType,
271-
Integer userCount,
272-
Double staticIpScore
273-
) {
274-
this(
275-
autonomousSystemNumber,
276-
autonomousSystemOrganization,
277-
connectionType,
278-
domain,
279-
ipAddress,
280-
isAnonymous,
281-
isAnonymousProxy,
282-
isAnonymousVpn,
283-
false, // isAnycast
284-
isHostingProvider,
285-
isLegitimateProxy,
286-
isPublicProxy,
287-
isResidentialProxy,
288-
isSatelliteProvider,
289-
isTorExitNode,
290-
isp,
291-
mobileCountryCode,
292-
mobileNetworkCode,
293-
network,
294-
organization,
295-
userType,
296-
userCount,
297-
staticIpScore
298-
);
299-
}
300209

301-
/**
302-
* @deprecated will be removed in the next major version.
303-
*
304-
* @param autonomousSystemNumber the autonomous system number
305-
* @param autonomousSystemOrganization the autonomous system organization
306-
* @param connectionType the connection type
307-
* @param domain the domain
308-
* @param ipAddress the IP address
309-
* @param isAnonymous the anonymous flag
310-
* @param isAnonymousProxy the anonymous proxy flag
311-
* @param isAnonymousVpn the anonymous VPN flag
312-
* @param isHostingProvider the hosting provider flag
313-
* @param isLegitimateProxy the legitimate proxy flag
314-
* @param isPublicProxy the public proxy flag
315-
* @param isResidentialProxy the residential proxy flag
316-
* @param isSatelliteProvider the satellite provider flag
317-
* @param isTorExitNode the Tor exit node flag
318-
* @param isp the ISP
319-
* @param mobileCountryCode the mobile country code
320-
* @param mobileNetworkCode the mobile network code
321-
* @param network the network
322-
* @param organization the organization
323-
* @param userType the user type
324-
* @param userCount the user count
325-
* @param staticIpScore the static IP score
326-
*/
327-
@Deprecated
328-
public Traits(
329-
Long autonomousSystemNumber,
330-
String autonomousSystemOrganization,
331-
String connectionType,
332-
String domain,
333-
String ipAddress,
334-
Boolean isAnonymous,
335-
Boolean isAnonymousProxy,
336-
Boolean isAnonymousVpn,
337-
Boolean isHostingProvider,
338-
Boolean isLegitimateProxy,
339-
Boolean isPublicProxy,
340-
Boolean isResidentialProxy,
341-
Boolean isSatelliteProvider,
342-
Boolean isTorExitNode,
343-
String isp,
344-
String mobileCountryCode,
345-
String mobileNetworkCode,
346-
Network network,
347-
String organization,
348-
String userType,
349-
Integer userCount,
350-
Double staticIpScore
351-
) {
352-
this(
353-
autonomousSystemNumber,
354-
autonomousSystemOrganization,
355-
connectionType,
356-
domain,
357-
ipAddress,
358-
isAnonymous,
359-
isAnonymousProxy,
360-
isAnonymousVpn,
361-
false, // isAnycast
362-
isHostingProvider,
363-
isLegitimateProxy,
364-
isPublicProxy,
365-
isResidentialProxy,
366-
isSatelliteProvider,
367-
isTorExitNode,
368-
isp,
369-
mobileCountryCode,
370-
mobileNetworkCode,
371-
network,
372-
organization,
373-
userType,
374-
userCount,
375-
staticIpScore
376-
);
377-
}
378210

379211
/**
380212
* Constructs an instance of {@code Traits}.
@@ -395,14 +227,12 @@ public Traits(
395227
traits.getDomain(),
396228
ipAddress,
397229
traits.isAnonymous(),
398-
traits.isAnonymousProxy(),
399230
traits.isAnonymousVpn(),
400231
traits.isAnycast(),
401232
traits.isHostingProvider(),
402233
traits.isLegitimateProxy(),
403234
traits.isPublicProxy(),
404235
traits.isResidentialProxy(),
405-
traits.isSatelliteProvider(),
406236
traits.isTorExitNode(),
407237
traits.getIsp(),
408238
traits.getMobileCountryCode(),
@@ -511,17 +341,6 @@ public boolean isAnonymous() {
511341
return this.isAnonymous;
512342
}
513343

514-
/**
515-
* @return This is true if the IP is an anonymous proxy.
516-
* @deprecated Use our
517-
* <a href="https://www.maxmind.com/en/geoip2-anonymous-ip-database">GeoIP2
518-
* Anonymous IP database</a> instead.
519-
*/
520-
@Deprecated
521-
@JsonProperty("is_anonymous_proxy")
522-
public boolean isAnonymousProxy() {
523-
return this.isAnonymousProxy;
524-
}
525344

526345
/**
527346
* @return This is true if the IP address is registered to an anonymous
@@ -584,16 +403,6 @@ public boolean isResidentialProxy() {
584403
return this.isResidentialProxy;
585404
}
586405

587-
/**
588-
* @return This is true if the IP belong to a satellite Internet provider.
589-
* @deprecated Due to increased mobile usage, we have insufficient data to
590-
* maintain this field.
591-
*/
592-
@Deprecated
593-
@JsonProperty("is_satellite_provider")
594-
public boolean isSatelliteProvider() {
595-
return this.isSatelliteProvider;
596-
}
597406

598407
/**
599408
* @return This is true if the IP address belongs to a Tor exit node.

src/test/java/com/maxmind/geoip2/WebServiceClientTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ public void test200WithDefaultValues() throws Exception {
9999
assertNull(location.getAccuracyRadius());
100100
assertNull(location.getLatitude());
101101
assertNull(location.getLongitude());
102-
assertNull(location.getMetroCode());
103102
assertNull(location.getTimeZone());
104103
assertThat(location.toString(),
105104
CoreMatchers.equalTo("com.maxmind.geoip2.record.Location [ {} ]"));
@@ -145,9 +144,7 @@ public void test200WithDefaultValues() throws Exception {
145144
assertNull(traits.getUserType());
146145
assertNull(traits.getStaticIpScore());
147146
assertNull(traits.getUserCount());
148-
assertFalse(traits.isAnonymousProxy());
149147
assertFalse(traits.isAnycast());
150-
assertFalse(traits.isSatelliteProvider());
151148

152149
for (Country c : new Country[] {country, registeredCountry,
153150
representedCountry}) {

src/test/java/com/maxmind/geoip2/model/InsightsResponseTest.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,10 @@ public void testTraits() {
139139
"traits.getIpAddress() does not return 1.2.3.4"
140140
);
141141
assertTrue(traits.isAnonymous(), "traits.isAnonymous() returns true");
142-
assertTrue(traits.isAnonymousProxy(), "traits.isAnonymousProxy() returns true");
143142
assertTrue(traits.isAnonymousVpn(), "traits.isAnonymousVpn() returns true");
144143
assertTrue(traits.isHostingProvider(), "traits.isHostingProvider() returns true");
145144
assertTrue(traits.isPublicProxy(), "traits.isPublicProxy() returns true");
146145
assertTrue(traits.isResidentialProxy(), "traits.isResidentialProxy() returns true");
147-
assertTrue(traits.isSatelliteProvider(), "traits.isSatelliteProvider() returns true");
148146
assertTrue(traits.isTorExitNode(), "traits.isTorExitNode() returns true");
149147
assertEquals(
150148
"Comcast",
@@ -207,11 +205,6 @@ public void testLocation() {
207205
0.1,
208206
"location.getLongitude() does not return 93.2636"
209207
);
210-
assertEquals(
211-
Integer.valueOf(765),
212-
location.getMetroCode(),
213-
"location.getMetroCode() does not return 765"
214-
);
215208
assertEquals(
216209
Integer.valueOf(1341),
217210
location.getPopulationDensity(),

0 commit comments

Comments
 (0)