Latest Stable Version Total Downloads

IP2Proxy Ruby Library

This module allows user to reverse search of IP address to detect VPN servers, open proxies, web proxies, Tor exit nodes, search engine robots, data center ranges and residential proxies using IP2Proxy BIN database. Other information available includes proxy type, country, state, city, ISP, domain name, usage type, AS number, AS name, threats, last seen date and provider names. It lookup the proxy IP address from IP2Proxy BIN Data file or web service.

For more details, please visit: https://www.ip2location.com/ip2proxy/developers/ruby

Usage

You can check the example.rb file to learn more about usage.

BIN Database

An outdated BIN database was provided in the library for your testing. You are recommended to visit the links to download the latest BIN database and save it in the rb folder.

Below is the description of the functions available in the BIN Database lookup.

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 11 for PX1 to PX11 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. Please see Proxy Type for details. 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.
get_domain Return the domain name of proxy's IP address or domain name.
get_usagetype Return the ISP's usage type of proxy's IP address or domain name. Please see Usage Type for details.
get_asn Return the autonomous system number (ASN) of proxy's IP address or domain name.
get_as Return the autonomous system (AS) name of proxy's IP address or domain name.
get_last_seen Return the last seen days ago value of proxy's IP address or domain name.
get_threat Return the threat types reported to proxy's IP address or domain name. Please see Threat Type for details.
get_provider Returns the VPN service provider name if available.

Web Service

Below is the description of the functions available in the Web Service lookup.

Function Name Description
Constructor Expect 3 input parameters:
  1. IP2Proxy API Key.
  2. Package (PX1 - PX11)
  3. Use HTTPS or HTTP
lookup Return the proxy information in array.
  • countryCode
  • countryName
  • regionName
  • cityName
  • isp
  • domain
  • usageType
  • asn
  • as
  • lastSeen
  • threat
  • proxyType
  • isProxy
  • provider
    get_credit Return remaining credit of the web service account.

    Proxy Type

    Proxy Type Description
    VPN Anonymizing VPN services
    TOR Tor Exit Nodes
    PUB Public Proxies
    WEB Web Proxies
    DCH Hosting Providers/Data Center
    SES Search Engine Robots
    RES Residential Proxies [PX10+]

    Usage Type

    Usage Type Description
    COM Commercial
    ORG Organization
    GOV Government
    MIL Military
    EDU University/College/School
    LIB Library
    CDN Content Delivery Network
    ISP Fixed Line ISP
    MOB Mobile ISP
    DCH Data Center/Web Hosting/Transit
    SES Search Engine Spider
    RSV Reserved

    Threat Type

    Threat Type Description
    SPAM Spammer
    SCANNER Security Scanner or Attack
    BOTNET Spyware or Malware

    Dependencies

    This library requires IP2Proxy BIN data file to function. You may download the BIN data file at

    You can also sign up for IP2Proxy Web Service to lookup by IP2Proxy API.

    Support

    Email: [email protected]
    URL: https://www.ip2location.com