Skip to content

Commit 681d602

Browse files
committed
Updated README
1 parent 05ce58b commit 681d602

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

README.md

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,43 @@
1-
IP2Proxy Java Component
2-
=======================
1+
# IP2Proxy Java Component
32

4-
This is the Java component to lookup IP2Proxy databases from https://www.ip2location.com/proxy-database
3+
This component allows user to query an IP address if it was being used as open proxy, web proxy, VPN anonymizer and TOR exits. It lookup the proxy IP address from **IP2Proxy BIN Data** file. This data file can be downloaded at
54

6-
IP2Proxy Database contains IP addresses which are used as VPN anonymizer, open proxies, web proxies and Tor exits. The database includes records for all public IPv4 addresses.
5+
* Free IP2Proxy BIN Data: http://lite.ip2location.com
6+
* Commercial IP2Proxy BIN Data: http://www.ip2location.com/proxy-database
77

8+
## Compilation
89

9-
Compilation
10-
===========
1110
```bash
1211
javac com/ip2proxy/*.java
1312
jar cf ip2proxy.jar com/ip2proxy/*.class
1413
```
1514

16-
Sample Code
17-
===========
15+
## Methods
16+
Below are the methods supported in this class.
17+
18+
|Method Name|Description|
19+
|---|---|
20+
|Open|Open the IP2Proxy BIN data for lookup. Please see the **Usage** section of the 2 modes supported to load the BIN data file.|
21+
|Close|Close and clean up the file pointer.|
22+
|GetPackageVersion|Get the package version (1 to 4 for PX1 to PX4 respectively).|
23+
|GetModuleVersion|Get the module version.|
24+
|GetDatabaseVersion|Get the database version.|
25+
|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</li></ul>|
26+
|GetAll|Return the proxy information in an object.|
27+
|GetProxyType|Return the proxy type. Please visit <a href="https://www.ip2location.com/databases/px4-ip-proxytype-country-region-city-isp" target="_blank">IP2Location</a> for the list of proxy types supported|
28+
|GetCountryShort|Return the ISO3166-1 country code (2-digits) of the proxy.|
29+
|GetCountryLong|Return the ISO3166-1 country name of the proxy.|
30+
|GetRegion|Return the ISO3166-2 region name of the proxy. Please visit <a href="https://www.ip2location.com/free/iso3166-2" target="_blank">ISO3166-2 Subdivision Code</a> for the information of ISO3166-2 supported|
31+
|GetCity|Return the city name of the proxy.|
32+
|GetISP|Return the ISP name of the proxy.|
33+
34+
## Usage
35+
36+
Open and read IP2Proxy binary database. There are 2 modes:
37+
38+
1. **IOModes.IP2PROXY_FILE_IO** - File I/O reading. Slower look, but low resource consuming. This is the default.
39+
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.
40+
1841
```java
1942
import com.ip2proxy.*;
2043

@@ -37,7 +60,7 @@ public class Main {
3760

3861
String IP = "221.121.146.0";
3962

40-
if (Proxy.Open("/usr/data/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP.BIN", IP2Proxy.IOModes.IP2PROXY_MEMORY_MAPPED) == 0) {
63+
if (Proxy.Open("/usr/data/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP.SAMPLE.BIN", IP2Proxy.IOModes.IP2PROXY_MEMORY_MAPPED) == 0) {
4164
System.out.println("GetModuleVersion: " + Proxy.GetModuleVersion());
4265
System.out.println("GetPackageVersion: " + Proxy.GetPackageVersion());
4366
System.out.println("GetDatabaseVersion: " + Proxy.GetDatabaseVersion());

0 commit comments

Comments
 (0)