IP2Proxy Node.js API
IP2Proxy Class
- class IP2Proxy
Construct the IP2Proxy Class.
- open(binPath)
Load the IP2Proxy BIN database for lookup.
- Parameters:
binPath (str) – (Required) The file path links to IP2Proxy BIN databases.
- openAsync(binPath)
Load the IP2Proxy BIN database for lookup asynchronously.
- Parameters:
binPath (str) – (Required) The file path links to IP2Proxy BIN databases.
- getPackageVersion()
Return the database’s type, 1 to 12 respectively for PX1 to PX12. Please visit https://www.ip2location.com/databases/ip2proxy for details.
- Returns:
Returns the package version.
- Return type:
string
- getModuleVersion()
Return the version of module.
- Returns:
Returns the module version.
- Return type:
string
- getDatabaseVersion()
Return the database’s compilation date as a string of the form ‘YYYY-MM-DD’.
- Returns:
Returns the database version.
- Return type:
string
- getAll(ipAddress)
Retrieve geolocation information for an IP address.
- Parameters:
ipAddress (string) – (Required) The IP address (IPv4 or IPv6).
- Returns:
Returns the geolocation information in array. Refer below table for the fields avaliable in the array
- Return type:
array
RETURN FIELDS
Field Name
Description
countryCode
Two-character country code based on ISO 3166.
countryName
Country name based on ISO 3166.
regionName
Region or state name.
cityName
City name.
isp
Internet Service Provider or company’s name.
domain
Internet domain name associated with IP address range.
usageType
Usage type classification of ISP or company.
asn
Autonomous system number (ASN).
as
Autonomous system (AS) name.
lastSeen
Proxy last seen in days.
threat
Security threat reported.
proxyType
Type of proxy.
provider
Name of VPN provider if available.
fraudScore
Potential risk score (0 - 99) associated with IP address.
- getAllAsync(ipAddress)
Retrieve geolocation information for an IP address asynchronously.
- Parameters:
ipAddress (string) – (Required) The IP address (IPv4 or IPv6).
- Returns:
Returns the geolocation information in array. Refer below table for the fields avaliable in the array
- Return type:
Promise of an array
RETURN FIELDS
Field Name
Description
countryCode
Two-character country code based on ISO 3166.
countryName
Country name based on ISO 3166.
regionName
Region or state name.
cityName
City name.
isp
Internet Service Provider or company’s name.
domain
Internet domain name associated with IP address range.
usageType
Usage type classification of ISP or company.
asn
Autonomous system number (ASN).
as
Autonomous system (AS) name.
lastSeen
Proxy last seen in days.
threat
Security threat reported.
proxyType
Type of proxy.
provider
Name of VPN provider if available.
fraudScore
Potential risk score (0 - 99) associated with IP address.