Skip to content

Commit 9aa2ded

Browse files
committed
Update README.md
1 parent 1829a8f commit 9aa2ded

File tree

1 file changed

+2
-156
lines changed

1 file changed

+2
-156
lines changed

README.md

Lines changed: 2 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -8,159 +8,5 @@ This package allows user to query an IP address if it was being used as VPN anon
88
* Free IP2Proxy BIN Data: https://lite.ip2location.com
99
* Commercial IP2Proxy BIN Data: https://www.ip2location.com/database/ip2proxy
1010

11-
As an alternative, this package 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:
12-
13-
https://www.ip2location.com/web-service/ip2proxy
14-
15-
## Installation
16-
17-
To install this module type the following:
18-
19-
```bash
20-
21-
go get github.com/ip2location/ip2proxy-go/v4
22-
23-
```
24-
25-
## QUERY USING THE BIN FILE
26-
27-
## Methods
28-
Below are the methods supported in this package.
29-
30-
|Method Name|Description|
31-
|---|---|
32-
|OpenDB|Open the IP2Proxy BIN data for lookup.|
33-
|Close|Close and clean up the file pointer.|
34-
|PackageVersion|Get the package version (1 to 11 for PX1 to PX11 respectively).|
35-
|ModuleVersion|Get the module version.|
36-
|DatabaseVersion|Get the database version.|
37-
|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>|
38-
|GetAll|Return the proxy information in an array.|
39-
|GetProxyType|Return the proxy type. Please visit <a href="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.|
40-
|GetCountryShort|Return the ISO3166-1 country code (2-digits) of the proxy.|
41-
|GetCountryLong|Return the ISO3166-1 country name of the proxy.|
42-
|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.|
43-
|GetCity|Return the city name of the proxy.|
44-
|GetIsp|Return the ISP name of the proxy.|
45-
|GetDomain|Return the domain name of the proxy.|
46-
|GetUsageType|Return the usage type classification of the proxy. Please visit <a href="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.|
47-
|GetAsn|Return the autonomous system number of the proxy.|
48-
|GetAs|Return the autonomous system name of the proxy.|
49-
|GetLastSeen|Return the number of days that the proxy was last seen.|
50-
|GetThreat|Return the threat type of the proxy.|
51-
|GetProvider|Return the provider of the proxy.|
52-
53-
## Usage
54-
55-
```go
56-
package main
57-
58-
import (
59-
"fmt"
60-
"strconv"
61-
"github.com/ip2location/ip2proxy-go/v4"
62-
)
63-
64-
func main() {
65-
db, err := ip2proxy.OpenDB("./IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL-PROVIDER.BIN")
66-
67-
if err != nil {
68-
return
69-
}
70-
ip := "199.83.103.79"
71-
all, err := db.GetAll(ip)
72-
73-
if err != nil {
74-
fmt.Print(err)
75-
return
76-
}
77-
78-
fmt.Printf("ModuleVersion: %s\n", ip2proxy.ModuleVersion())
79-
fmt.Printf("PackageVersion: %s\n", db.PackageVersion())
80-
fmt.Printf("DatabaseVersion: %s\n", db.DatabaseVersion())
81-
82-
fmt.Printf("IsProxy: %s\n", strconv.Itoa(int(all.IsProxy)));
83-
fmt.Printf("ProxyType: %s\n", all.ProxyType);
84-
fmt.Printf("CountryShort: %s\n", all.CountryShort);
85-
fmt.Printf("CountryLong: %s\n", all.CountryLong);
86-
fmt.Printf("Region: %s\n", all.Region);
87-
fmt.Printf("City: %s\n", all.City);
88-
fmt.Printf("Isp: %s\n", all.Isp);
89-
fmt.Printf("Domain: %s\n", all.Domain);
90-
fmt.Printf("UsageType: %s\n", all.UsageType);
91-
fmt.Printf("Asn: %s\n", all.Asn);
92-
fmt.Printf("As: %s\n", all.As);
93-
fmt.Printf("LastSeen: %s\n", all.LastSeen);
94-
fmt.Printf("Threat: %s\n", all.Threat);
95-
96-
db.Close()
97-
}
98-
```
99-
100-
## QUERY USING THE IP2PROXY PROXY DETECTION WEB SERVICE
101-
102-
## Methods
103-
Below are the methods supported in this class.
104-
105-
|Method Name|Description|
106-
|---|---|
107-
|OpenWS(apikey string, apipackage string, usessl bool)| Expects 3 input parameters:<ol><li>IP2Proxy API Key.</li><li>Package (PX1 - PX11)</li></li><li>Use HTTPS or HTTP</li></ol> |
108-
|LookUp(ipAddress string)|Query IP address. This method returns a struct 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>|
109-
|GetCredit()|This method returns the web service credit balance in a struct.|
110-
111-
```go
112-
package main
113-
114-
import (
115-
"fmt"
116-
"github.com/ip2location/ip2proxy-go/v3"
117-
)
118-
119-
func main() {
120-
apikey := "YOUR_API_KEY"
121-
apipackage := "PX11"
122-
usessl := true
123-
124-
ws, err := ip2proxy.OpenWS(apikey, apipackage, usessl)
125-
126-
if err != nil {
127-
fmt.Print(err)
128-
return
129-
}
130-
ip := "8.8.8.8"
131-
res, err := ws.LookUp(ip)
132-
133-
if err != nil {
134-
fmt.Print(err)
135-
return
136-
}
137-
138-
if res.Response != "OK" {
139-
fmt.Printf("Error: %s\n", res.Response)
140-
} else {
141-
fmt.Printf("IsProxy: %s\n", res.IsProxy)
142-
fmt.Printf("ProxyType: %s\n", res.ProxyType)
143-
fmt.Printf("CountryCode: %s\n", res.CountryCode)
144-
fmt.Printf("CountryName: %s\n", res.CountryName)
145-
fmt.Printf("RegionName: %s\n", res.RegionName)
146-
fmt.Printf("CityName: %s\n", res.CityName)
147-
fmt.Printf("ISP: %s\n", res.ISP)
148-
fmt.Printf("Domain: %s\n", res.Domain)
149-
fmt.Printf("UsageType: %s\n", res.UsageType)
150-
fmt.Printf("ASN: %s\n", res.ASN)
151-
fmt.Printf("AS: %s\n", res.AS)
152-
fmt.Printf("LastSeen: %s\n", res.LastSeen)
153-
fmt.Printf("Threat: %s\n", res.Threat)
154-
fmt.Printf("Provider: %s\n", res.Provider)
155-
}
156-
157-
res2, err := ws.GetCredit()
158-
159-
if err != nil {
160-
fmt.Print(err)
161-
return
162-
}
163-
164-
fmt.Printf("Credit Balance: %s\n", res2.Response)
165-
}
166-
```
11+
## Developer Documentation
12+
To learn more about installation, usage, and code examples, please visit the developer documentation at [https://ip2proxy-go.readthedocs.io/en/latest/index.html.](https://ip2proxy-go.readthedocs.io/en/latest/index.html)

0 commit comments

Comments
 (0)