Skip to content

Commit 93abfd4

Browse files
committed
Update README.md
1 parent 455c738 commit 93abfd4

File tree

1 file changed

+3
-139
lines changed

1 file changed

+3
-139
lines changed

README.md

Lines changed: 3 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -5,144 +5,8 @@ This Haskell package allows user to query an IP address if it was being used as
55
* Free IP2Proxy BIN Data: https://lite.ip2location.com
66
* Commercial IP2Proxy BIN Data: https://www.ip2location.com/database/ip2proxy
77

8-
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:
98

10-
https://www.ip2location.com/web-service/ip2proxy
9+
Developer Documentation
10+
=====================
1111

12-
## Installation
13-
14-
```bash
15-
cabal install IP2Proxy
16-
```
17-
18-
## QUERY USING THE BIN FILE
19-
20-
## Methods
21-
Below are the methods supported in this package.
22-
23-
|Method Name|Description|
24-
|---|---|
25-
|open|Open the IP2Proxy BIN data for lookup.|
26-
|getPackageVersion|Get the package version (1 to 11 for PX1 to PX11 respectively).|
27-
|getModuleVersion|Get the module version.|
28-
|getDatabaseVersion|Get the database version.|
29-
|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>|
30-
|getAll|Return the proxy information in a record.|
31-
|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.|
32-
|getCountryShort|Return the ISO3166-1 country code (2-digits) of the proxy.|
33-
|getCountryLong|Return the ISO3166-1 country name of the proxy.|
34-
|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.|
35-
|getCity|Return the city name of the proxy.|
36-
|getISP|Return the ISP name of the proxy.|
37-
|getDomain|Return the domain name of the proxy.|
38-
|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.|
39-
|getASN|Return the autonomous system number of the proxy.|
40-
|getAS|Return the autonomous system name of the proxy.|
41-
|getLastSeen|Return the number of days that the proxy was last seen.|
42-
|getThreat|Return the threat type of the proxy.|
43-
|getProvider|Return the provider of the proxy.|
44-
45-
## Usage
46-
47-
```haskell
48-
import IP2Proxy
49-
50-
main :: IO ()
51-
main = do
52-
let myfile = "./IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL-PROVIDER.BIN"
53-
let ip = "199.83.103.79"
54-
meta <- open myfile
55-
56-
putStrLn $ "module_version: " ++ getModuleVersion
57-
putStrLn $ "package_version: " ++ (getPackageVersion meta)
58-
putStrLn $ "database_version: " ++ (getDatabaseVersion meta)
59-
60-
result <- getAll myfile meta ip
61-
putStrLn $ "country_short: " ++ (show (country_short result))
62-
putStrLn $ "country_long: " ++ (show (country_long result))
63-
putStrLn $ "region: " ++ (show (region result))
64-
putStrLn $ "city: " ++ (show (city result))
65-
putStrLn $ "isp: " ++ (show (isp result))
66-
putStrLn $ "proxy_type: " ++ (show (proxy_type result))
67-
putStrLn $ "domain: " ++ (show (domain result))
68-
putStrLn $ "usage_type: " ++ (show (usage_type result))
69-
putStrLn $ "asn: " ++ (show (asn result))
70-
putStrLn $ "as: " ++ (show (as result))
71-
putStrLn $ "last_seen: " ++ (show (last_seen result))
72-
putStrLn $ "threat: " ++ (show (threat result))
73-
putStrLn $ "provider: " ++ (show (provider result))
74-
putStrLn $ "is_proxy: " ++ (show (is_proxy result))
75-
76-
result <- getCountryShort myfile meta ip
77-
putStrLn $ "country_short: " ++ result
78-
result <- getCountryLong myfile meta ip
79-
putStrLn $ "country_long: " ++ result
80-
result <- getRegion myfile meta ip
81-
putStrLn $ "region: " ++ result
82-
result <- getCity myfile meta ip
83-
putStrLn $ "city: " ++ result
84-
result <- getISP myfile meta ip
85-
putStrLn $ "isp: " ++ result
86-
result <- getProxyType myfile meta ip
87-
putStrLn $ "proxy_type: " ++ result
88-
result <- getDomain myfile meta ip
89-
putStrLn $ "domain: " ++ result
90-
result <- getUsageType myfile meta ip
91-
putStrLn $ "usage_type: " ++ result
92-
result <- getASN myfile meta ip
93-
putStrLn $ "asn: " ++ result
94-
result <- getAS myfile meta ip
95-
putStrLn $ "as: " ++ result
96-
result <- getLastSeen myfile meta ip
97-
putStrLn $ "last_seen: " ++ result
98-
result <- getThreat myfile meta ip
99-
putStrLn $ "threat: " ++ result
100-
result <- getProvider myfile meta ip
101-
putStrLn $ "provider: " ++ result
102-
result <- isProxy myfile meta ip
103-
putStrLn $ "is_proxy: " ++ result
104-
```
105-
106-
## QUERY USING THE IP2PROXY PROXY DETECTION WEB SERVICE
107-
108-
## Methods
109-
Below are the methods supported in this package.
110-
111-
|Method Name|Description|
112-
|---|---|
113-
|openWS| Expects 3 input parameters:<ol><li>IP2Proxy API Key.</li><li>Package (PX1 - PX11)</li></li><li>Use HTTPS or HTTP</li></ol> |
114-
|lookUp|Query IP address. This method returns a WSResult record 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>|
115-
|getCredit|This method returns the web service credit balance in a WSResult record.|
116-
117-
## Usage
118-
119-
```haskell
120-
import IP2ProxyWebService
121-
import Data.Maybe
122-
123-
main :: IO ()
124-
main = do
125-
let apikey = "YOUR_API_KEY"
126-
let apipackage = "PX11"
127-
let usessl = True
128-
let ip = "37.252.228.50"
129-
wsconfig <- openWS apikey apipackage usessl
130-
result <- lookUp wsconfig ip
131-
putStrLn $ "response: " ++ (response result)
132-
putStrLn $ "countryCode: " ++ (fromMaybe ("-") $ (countryCode result))
133-
putStrLn $ "countryName: " ++ (fromMaybe ("-") $ (countryName result))
134-
putStrLn $ "regionName: " ++ (fromMaybe ("-") $ (regionName result))
135-
putStrLn $ "cityName: " ++ (fromMaybe ("-") $ (cityName result))
136-
putStrLn $ "isp: " ++ (fromMaybe ("-") $ (isp result))
137-
putStrLn $ "domain: " ++ (fromMaybe ("-") $ (domain result))
138-
putStrLn $ "usageType: " ++ (fromMaybe ("-") $ (usageType result))
139-
putStrLn $ "asn: " ++ (fromMaybe ("-") $ (asn result))
140-
putStrLn $ "as: " ++ (fromMaybe ("-") $ (as result))
141-
putStrLn $ "lastSeen: " ++ (fromMaybe ("-") $ (lastSeen result))
142-
putStrLn $ "proxyType: " ++ (fromMaybe ("-") $ (proxyType result))
143-
putStrLn $ "threat: " ++ (fromMaybe ("-") $ (threat result))
144-
putStrLn $ "isProxy: " ++ (fromMaybe ("-") $ (isProxy result))
145-
putStrLn $ "provider: " ++ (fromMaybe ("-") $ (provider result))
146-
result <- getCredit wsconfig
147-
putStrLn $ "Credit Balance: " ++ (response result)
148-
```
12+
To learn more about installation, usage, and code examples, please visit the developer documentation at [https://ip2location-haskell.readthedocs.io/en/latest/](https://ip2location-haskell.readthedocs.io/en/latest/).

0 commit comments

Comments
 (0)