-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a3a71df
commit b5ed42e
Showing
10 changed files
with
310 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# .readthedocs.yaml | ||
# Read the Docs configuration file | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
# Required | ||
version: 2 | ||
|
||
# Set the OS, Python version and other tools you might need | ||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: "3.11" | ||
# You can also specify other tool versions: | ||
# nodejs: "19" | ||
# rust: "1.64" | ||
# golang: "1.19" | ||
|
||
# Build documentation in the "docs/" directory with Sphinx | ||
sphinx: | ||
configuration: docs/source/conf.py | ||
|
||
# Optionally build your docs in additional formats such as PDF and ePub | ||
# formats: | ||
# - epub | ||
|
||
# Optional but recommended, declare the Python requirements required | ||
# to build your documentation | ||
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html | ||
python: | ||
install: | ||
- requirements: docs/requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = source | ||
BUILDDIR = build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@ECHO OFF | ||
|
||
pushd %~dp0 | ||
|
||
REM Command file for Sphinx documentation | ||
|
||
if "%SPHINXBUILD%" == "" ( | ||
set SPHINXBUILD=sphinx-build | ||
) | ||
set SOURCEDIR=source | ||
set BUILDDIR=build | ||
|
||
%SPHINXBUILD% >NUL 2>NUL | ||
if errorlevel 9009 ( | ||
echo. | ||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
echo.installed, then set the SPHINXBUILD environment variable to point | ||
echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
echo.may add the Sphinx directory to PATH. | ||
echo. | ||
echo.If you don't have Sphinx installed, grab it from | ||
echo.https://www.sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
|
||
:end | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Defining the exact version will make sure things don't break | ||
sphinx-book-theme==1.0.1 | ||
# sphinx-pdj-theme==0.4.0 | ||
myst-parser==2.0.0 | ||
markdown-it-py==3.0.0 | ||
sphinx-copybutton==0.5.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# IP2Proxy Node.js API | ||
|
||
## IP2Proxy Class | ||
```{py:class} IP2Proxy() | ||
Construct the IP2Location Class. | ||
``` | ||
|
||
```{py:function} open(binPath) | ||
Load the IP2Proxy BIN database for lookup. | ||
:param str binPath: (Required) The file path links to IP2Proxy BIN databases. | ||
``` | ||
|
||
```{py:function} getPackageVersion() | ||
Return the database's type, 1 to 10 respectively for PX1 to PX11. Please visit https://www.ip2location.com/databases/ip2proxy for details. | ||
:return: Returns the package version. | ||
:rtype: string | ||
``` | ||
|
||
```{py:function} getModuleVersion() | ||
Return the version of module. | ||
:return: Returns the module version. | ||
:rtype: string | ||
``` | ||
|
||
```{py:function} getDatabaseVersion() | ||
Return the database's compilation date as a string of the form 'YYYY-MM-DD'. | ||
:return: Returns the database version. | ||
:rtype: string | ||
``` | ||
|
||
```{py:function} getAll(ipAddress) | ||
Retrieve geolocation information for an IP address. | ||
:param string ipAddress: (Required) The IP address (IPv4 or IPv6). | ||
:return: Returns the geolocation information in array. Refer below table for the fields avaliable in the array | ||
:rtype: 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. | | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# Read https://www.sphinx-doc.org/en/master/usage/configuration.html for more options available | ||
|
||
# -- Project information | ||
|
||
project = 'IP2Proxy PHP' | ||
copyright = '2023, IP2Location' | ||
author = 'IP2Location' | ||
|
||
release = '0.1.0' | ||
version = '0.1.0' | ||
|
||
# -- General configuration | ||
|
||
extensions = [ | ||
'sphinx.ext.duration', | ||
'sphinx.ext.doctest', | ||
'myst_parser', | ||
'sphinx_copybutton', | ||
] | ||
|
||
# https://myst-parser.readthedocs.io/en/latest/syntax/optional.html | ||
|
||
myst_enable_extensions = [ | ||
"colon_fence", | ||
"deflist", | ||
"fieldlist", | ||
] | ||
|
||
# https://myst-parser.readthedocs.io/en/latest/configuration.html#setting-html-metadata | ||
myst_html_meta = { | ||
"description": "IP2Proxy Node.js library enables user to query an IP address if it was being used as open proxy, web proxy, VPN anonymizer and TOR exits.", | ||
"keywords": "IP2Proxy, Proxy, IP location, NodeJS", | ||
"google-site-verification": "DeW6mXDyMnMt4i61ZJBNuoADPimo5266DKob7Z7d6i4", | ||
} | ||
|
||
# templates_path = ['_templates'] | ||
|
||
# -- Options for HTML output | ||
|
||
html_theme = 'sphinx_book_theme' | ||
|
||
html_theme_options = { | ||
"use_edit_page_button": False, | ||
"use_source_button": False, | ||
"use_issues_button": False, | ||
"use_download_button": False, | ||
"use_sidenotes": False, | ||
} | ||
} | ||
|
||
# The name of an image file (relative to this directory) to place at the top | ||
# of the sidebar. | ||
html_logo = 'images/ipl-logo-square-1200.png' | ||
|
||
# Favicon | ||
html_favicon = 'images/favicon.ico' | ||
|
||
html_title = "IP2Proxy Node.js" | ||
|
||
html_baseurl = "https://ip2proxy-nodejs.readthedocs.io/en/latest/" |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[![npm](https://img.shields.io/npm/v/ip2proxy-nodejs.svg)](http://npm.im/ip2proxy-nodejs) | ||
[![npm](https://img.shields.io/npm/dm/ip2proxy-nodejs.svg)](http://npm.im/ip2proxy-nodejs) | ||
|
||
# IP2Proxy Node.js Module | ||
|
||
This module allows user to query an IP address if it was being used as VPN anonymizer, open proxies, web proxies, Tor exits, data center, web hosting (DCH) range, search engine robots (SES) and residential (RES). It lookup the proxy IP address from **IP2Proxy BIN Data** file. This data file can be downloaded at | ||
|
||
* Free IP2Proxy BIN Data: https://lite.ip2location.com | ||
* Commercial IP2Proxy BIN Data: https://www.ip2location.com/database/ip2proxy | ||
|
||
|
||
|
||
|
||
## Table of contents | ||
```{eval-rst} | ||
.. toctree:: | ||
self | ||
quickstart | ||
code | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Quickstart | ||
|
||
## 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> | ||
|
||
## Installation | ||
|
||
Install this package using the command as below: | ||
|
||
```bash | ||
|
||
npm install ip2proxy-nodejs | ||
|
||
``` | ||
|
||
## Sample Codes | ||
|
||
### Query geolocation information from BIN database | ||
|
||
You can query the geolocation information from the IP2Proxy BIN database as below: | ||
|
||
```javascript | ||
const {IP2Proxy} = require("ip2proxy-nodejs"); | ||
|
||
let ip2proxy = new IP2Proxy(); | ||
|
||
if (ip2proxy.open("./IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL-PROVIDER.BIN") == 0) { | ||
ip = '199.83.103.79'; | ||
|
||
console.log("GetModuleVersion: " + ip2proxy.getModuleVersion()); | ||
console.log("GetPackageVersion: " + ip2proxy.getPackageVersion()); | ||
console.log("GetDatabaseVersion: " + ip2proxy.getDatabaseVersion()); | ||
|
||
// functions for individual fields | ||
console.log("isProxy: " + ip2proxy.isProxy(ip)); | ||
console.log("ProxyType: " + ip2proxy.getProxyType(ip)); | ||
console.log("CountryShort: " + ip2proxy.getCountryShort(ip)); | ||
console.log("CountryLong: " + ip2proxy.getCountryLong(ip)); | ||
console.log("Region: " + ip2proxy.getRegion(ip)); | ||
console.log("City: " + ip2proxy.getCity(ip)); | ||
console.log("ISP: " + ip2proxy.getISP(ip)); | ||
console.log("Domain: " + ip2proxy.getDomain(ip)); | ||
console.log("UsageType: " + ip2proxy.getUsageType(ip)); | ||
console.log("ASN: " + ip2proxy.getASN(ip)); | ||
console.log("AS: " + ip2proxy.getAS(ip)); | ||
console.log("LastSeen: " + ip2proxy.getLastSeen(ip)); | ||
console.log("Threat: " + ip2proxy.getThreat(ip)); | ||
console.log("Provider: " + ip2proxy.getProvider(ip)); | ||
|
||
// function for all fields | ||
let all = ip2proxy.getAll(ip); | ||
console.log("isProxy: " + all.isProxy); | ||
console.log("proxyType: " + all.proxyType); | ||
console.log("countryShort: " + all.countryShort); | ||
console.log("countryLong: " + all.countryLong); | ||
console.log("region: " + all.region); | ||
console.log("city: " + all.city); | ||
console.log("isp: " + all.isp); | ||
console.log("domain: " + all.domain); | ||
console.log("usagetype: " + all.usageType); | ||
console.log("asn: " + all.asn); | ||
console.log("as: " + all.as); | ||
console.log("lastSeen: " + all.lastSeen); | ||
console.log("threat: " + all.threat); | ||
console.log("provider: " + all.provider); | ||
} | ||
else { | ||
console.log("Error reading BIN file."); | ||
} | ||
ip2proxy.close(); | ||
``` |