You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-225Lines changed: 2 additions & 225 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,231 +5,8 @@ This component allows user to query an IP address if it was being used as VPN an
5
5
* Free IP2Proxy BIN Data: https://lite.ip2location.com
6
6
* Commercial IP2Proxy BIN Data: https://www.ip2location.com/database/ip2proxy
7
7
8
-
As an alternative, this component can also call the IP2Proxy Web Service. This requires an API key. If you don't have an existing API key, you can subscribe for one at the below:
9
-
10
-
https://www.ip2location.com/web-service/ip2proxy
11
-
12
-
## Compilation
13
-
14
-
```bash
15
-
javac com/ip2proxy/*.java
16
-
jar cf ip2proxy.jar com/ip2proxy/*.class
17
-
```
18
-
19
-
## QUERY USING THE BIN FILE
20
-
21
-
## Methods
22
-
Below are the methods supported in this class.
23
-
24
-
|Method Name|Description|
25
-
|---|---|
26
-
|Open|Open the IP2Proxy BIN data for lookup. Please see the **Usage** section of the 2 modes supported to load the BIN data file.|
27
-
|Close|Close and clean up the file pointer.|
28
-
|GetPackageVersion|Get the package version (1 to 11 for PX1 to PX11 respectively).|
29
-
|GetModuleVersion|Get the module version.|
30
-
|GetDatabaseVersion|Get the database version.|
31
-
|IsProxy|Check whether if an IP address was a proxy. Returned value:<ul><li>-1 : errors</li><li>0 : not a proxy</li><li>1 : a proxy</li><li>2 : a data center IP address or search engine robot</li></ul>|
32
-
|GetAll|Return the proxy information in an object.|
33
-
|GetProxyType|Return the proxy type. Please visit <ahref="https://www.ip2location.com/database/px10-ip-proxytype-country-region-city-isp-domain-usagetype-asn-lastseen-threat-residential"target="_blank">IP2Location</a> for the list of proxy types supported|
34
-
|GetCountryShort|Return the ISO3166-1 country code (2-digits) of the proxy.|
35
-
|GetCountryLong|Return the ISO3166-1 country name of the proxy.|
36
-
|GetRegion|Return the ISO3166-2 region name of the proxy. Please visit <ahref="https://www.ip2location.com/free/iso3166-2"target="_blank">ISO3166-2 Subdivision Code</a> for the information of ISO3166-2 supported|
37
-
|GetCity|Return the city name of the proxy.|
38
-
|GetISP|Return the ISP name of the proxy.|
39
-
|GetDomain|Return the domain name of the proxy.|
40
-
|GetUsageType|Return the usage type classification of the proxy. Please visit <ahref="https://www.ip2location.com/database/px10-ip-proxytype-country-region-city-isp-domain-usagetype-asn-lastseen-threat-residential"target="_blank">IP2Location</a> for the list of usage types supported.|
41
-
|GetASN|Return the autonomous system number of the proxy.|
42
-
|GetAS|Return the autonomous system name of the proxy.|
43
-
|GetLastSeen|Return the number of days that the proxy was last seen.|
44
-
|GetThreat|Return the threat type of the proxy.|
45
-
|GetProvider|Return the provider of the proxy.|
46
-
47
-
## Usage
48
-
49
-
Open and read IP2Proxy binary database. There are 2 modes:
50
-
51
-
1.**IOModes.IP2PROXY_FILE_IO** - File I/O reading. Slower lookup, but low resource consuming. This is the default.
52
-
2.**IOModes.IP2PROXY_MEMORY_MAPPED** - Stores whole IP2Proxy database into a memory-mapped file. Extremely resources consuming. Do not use this mode if your system do not have enough memory.
53
-
54
-
```java
55
-
importcom.ip2proxy.*;
56
-
57
-
publicclassMain {
58
-
publicMain() {
59
-
}
60
-
61
-
publicstaticvoidmain(String[] args) {
62
-
try {
63
-
IP2ProxyProxy=newIP2Proxy();
64
-
ProxyResultAll;
65
-
66
-
intIsProxy;
67
-
StringProxyType;
68
-
StringCountryShort;
69
-
StringCountryLong;
70
-
StringRegion;
71
-
StringCity;
72
-
StringISP;
73
-
StringDomain;
74
-
StringUsageType;
75
-
StringASN;
76
-
StringAS;
77
-
StringLastSeen;
78
-
StringThreat;
79
-
StringProvider;
80
-
81
-
StringIP="221.121.146.0";
82
-
83
-
if (Proxy.Open("/usr/data/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL-PROVIDER.BIN", IP2Proxy.IOModes.IP2PROXY_MEMORY_MAPPED) ==0) {
## QUERY USING THE IP2PROXY PROXY DETECTION WEB SERVICE
161
-
162
-
## Methods
163
-
Below are the methods supported in this class.
164
-
165
-
|Method Name|Description|
166
-
|---|---|
167
-
|Open(String APIKey, String Package, boolean UseSSL)| Expects 3 input parameters:<ol><li>IP2Proxy API Key.</li><li>Package (PX1 - PX11)</li></li><li>Use HTTPS or HTTP</li></ol>|
168
-
|IPQuery(String IPAddress)|Query IP address. This method returns a JsonObject containing the proxy info. <ul><li>countryCode</li><li>countryName</li><li>regionName</li><li>cityName</li><li>isp</li><li>domain</li><li>usageType</li><li>asn</li><li>as</li><li>lastSeen</li><li>threat</li><li>proxyType</li><li>isProxy</li><li>provider</li><ul>|
169
-
|GetCredit()|This method returns the web service credit balance in a JsonObject.|
170
-
171
-
## Usage
172
-
173
-
```java
174
-
importcom.ip2proxy.*;
175
-
importcom.google.gson.*;
176
-
177
-
publicclassMain {
178
-
publicMain() {
179
-
}
180
-
181
-
publicstaticvoidmain(String[] args) {
182
-
try
183
-
{
184
-
IP2ProxyWebService ws =newIP2ProxyWebService();
185
-
186
-
String strIPAddress ="8.8.8.8";
187
-
String strAPIKey ="YOUR_API_KEY";
188
-
String strPackage ="PX11";
189
-
boolean boolSSL =true;
190
-
191
-
ws.Open(strAPIKey, strPackage, boolSSL);
192
-
193
-
JsonObject myresult =ws.IPQuery(strIPAddress);
194
-
195
-
if ((myresult.get("response") !=null) && (myresult.get("response").getAsString().equals("OK")))
To learn more about installation, usage, and code examples, please visit the developer documentation at [https://ip2proxy-java.readthedocs.io/en/latest/index.html.](https://ip2proxy-java.readthedocs.io/en/latest/index.html)
0 commit comments