Get Started With IP2Proxy OCaml Module
Dependencies
This library requires IP2Proxy BIN database to function. You may download the BIN database at
IP2Proxy LITE BIN Data (Free): https://lite.ip2location.com
IP2Proxy Commercial BIN Data (Comprehensive): https://www.ip2location.com
Compilation
dune build
Sample Codes
Query geolocation information from BIN database
You can query the geolocation information from the IP2Proxy BIN database as below:
open Printf
open Ip2proxy
(* query IP2Proxy BIN datababase *)
let meta = Database.open_db "/path_to_your_database_file/your_BIN_file.BIN";;
let ip = "8.8.8.8";;
let res = Database.query meta ip;;
printf "country_short: %s\n" res.country_short;;
printf "country_long: %s\n" res.country_long;;
printf "region: %s\n" res.region;;
printf "city: %s\n" res.city;;
printf "isp: %s\n" res.isp;;
printf "proxy_type: %s\n" res.proxy_type;;
printf "is_proxy: %d\n" res.is_proxy;;
printf "domain: %s\n" res.domain;;
printf "usage_type: %s\n" res.usage_type;;
printf "asn: %s\n" res.asn;;
printf "as: %s\n" res.asys;;
printf "last_seen: %d\n" res.last_seen;;
printf "threat: %s\n" res.threat;;
printf "provider: %s\n" res.provider;;
printf "fraud_score: %s\n" res.fraud_score;;
Database.close_db meta;;
IP2Proxy Sample Database (BIN)
Sample Packages - BIN File | IPv4 + IPv6 |
---|---|
IP2Proxy PX1 | Download (391.66 kB) |
IP2Proxy PX2 | Download (406.53 kB) |
IP2Proxy PX3 | Download (435.82 kB) |
IP2Proxy PX4 | Download (471.49 kB) |
IP2Proxy PX5 | Download (491.37 kB) |
IP2Proxy PX6 | Download (493.92 kB) |
IP2Proxy PX7 | Download (534.57 kB) |
IP2Proxy PX8 | Download (540.70 kB) |
IP2Proxy PX9 | Download (541.56 kB) |
IP2Proxy PX10 | Download (677.91 kB) |
IP2Proxy PX11 | Download (684.40 kB) |
IP2Proxy PX12 | Download (687.12 kB) |