Ruby library for IP2Proxy database lookup. It can be used to find the IP addresses which are used as VPN anonymizer, open proxies, web proxies and Tor exits.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib Update method name. Oct 2, 2018
example.rb Update method name. Oct 2, 2018

IP2Proxy Ruby Library

This module 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

For more details, please visit:


Below are the methods supported in this module.

Method Name Description
open Open the IP2Proxy BIN data with File I/O mode for lookup.
close Close and clean up the file pointer.
get_package_version Get the package version (1 to 4 for PX1 to PX4 respectively).
get_module_version Get the module version.
get_database_version Get the database version.
is_proxy Check whether if an IP address was a proxy. Returned value:
  • -1 : errors
  • 0 : not a proxy
  • 1 : a proxy
  • 2 : a data center IP address
get_all Return the proxy information in array.
get_proxytype Return the proxy type. Please visit IP2Location for the list of proxy types supported
get_country_short Return the ISO3166-1 country code (2-digits) of the proxy.
get_country_long Return the ISO3166-1 country name of the proxy.
get_region Return the ISO3166-2 region name of the proxy. Please visit ISO3166-2 Subdivision Code for the information of ISO3166-2 supported
get_city Return the city name of the proxy.
get_isp Return the ISP name of the proxy.


require 'ip2proxy_ruby'

# open IP2Proxy BIN database for proxy lookup

# get versioning information
print 'Module Version: ' + i2p.get_module_version + "\n"
print 'Package Version: ' + i2p.get_package_version + "\n"
print 'Database Version: ' + i2p.get_database_version + "\n"

# individual proxy data check
print 'Is Proxy: ' + i2p.is_proxy('').to_s + "\n"
print 'Proxy Type: ' + i2p.get_proxytype('') + "\n"
print 'Country Code: ' + i2p.get_country_short('') + "\n"
print 'Country Name: ' + i2p.get_country_long('') + "\n"
print 'Region Name: ' + i2p.get_region('') + "\n"
print 'City Name: ' + i2p.get_city('') + "\n"
print 'ISP: ' + i2p.get_isp('') + "\n"

# single function to get all proxy data returned in array
record = i2p.get_all('')
print 'is Proxy: ' + record['is_proxy'].to_s + "\n"
print 'Proxy Type: ' + record['proxy_type'] + "\n"
print 'Country Code: ' + record['country_short'] + "\n"
print 'Country Name: ' + record['country_long'] + "\n"
print 'Region Name: ' + record['region'] + "\n"
print 'City Name: ' + record['city'] + "\n"
print 'ISP: ' + record['isp'] + "\n"

# close IP2Proxy BIN database