Skip to content

Commit 7ba4374

Browse files
committed
Add readthedocs documentation.
1 parent da020a7 commit 7ba4374

File tree

10 files changed

+340
-0
lines changed

10 files changed

+340
-0
lines changed

.readthedocs.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the OS, Python version and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.11"
13+
# You can also specify other tool versions:
14+
# nodejs: "19"
15+
# rust: "1.64"
16+
# golang: "1.19"
17+
18+
# Build documentation in the "docs/" directory with Sphinx
19+
sphinx:
20+
configuration: docs/source/conf.py
21+
22+
# Optionally build your docs in additional formats such as PDF and ePub
23+
# formats:
24+
# - pdf
25+
# - epub
26+
27+
# Optional but recommended, declare the Python requirements required
28+
# to build your documentation
29+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
30+
python:
31+
install:
32+
- requirements: docs/requirements.txt

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Defining the exact version will make sure things don't break
2+
sphinx-book-theme==1.0.1
3+
# sphinx-pdj-theme==0.4.0
4+
myst-parser==2.0.0
5+
markdown-it-py==3.0.0
6+
sphinx-copybutton==0.5.2

docs/source/code.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# IP2Proxy .NET API
2+
3+
## Component Class
4+
```{py:function} Open(DatabasePath)
5+
Load the IP2Proxy BIN database for lookup.
6+
7+
:param String DatabasePath: (Required) The file path links to IP2Proxy BIN databases.
8+
```
9+
10+
```{py:function} Close()
11+
Close and clean up the file pointer.
12+
```
13+
14+
```{py:function} GetPackageVersion()
15+
Return the database's type, 1 to 10 respectively for PX1 to PX11. Please visit https://www.ip2location.com/databases/ip2proxy for details.
16+
17+
:return: Returns the package version.
18+
:rtype: String
19+
```
20+
21+
```{py:function} GetModuleVersion()
22+
Return the version of module.
23+
24+
:return: Returns the module version.
25+
:rtype: String
26+
```
27+
28+
```{py:function} GetDatabaseVersion()
29+
Return the database's compilation date as a string of the form 'YYYY-MM-DD'.
30+
31+
:return: Returns the database version.
32+
:rtype: String
33+
```
34+
35+
```{py:function} GetAll(IP)
36+
Retrieve geolocation information for an IP address.
37+
38+
:param String IP: (Required) The IP address (IPv4 or IPv6).
39+
:return: Returns the geolocation information in array. Refer below table for the fields avaliable in the array
40+
:rtype: array
41+
42+
**RETURN FIELDS**
43+
44+
| Field Name | Description |
45+
| ---------------- | ------------------------------------------------------------ |
46+
| Country_Short | Two-character country code based on ISO 3166. |
47+
| Country_Long | Country name based on ISO 3166. |
48+
| Region | Region or state name. |
49+
| City | City name. |
50+
| Isp | Internet Service Provider or company\'s name. |
51+
| Domain | Internet domain name associated with IP address range. |
52+
| Usage_Type | Usage type classification of ISP or company. |
53+
| Asn | Autonomous system number (ASN). |
54+
| As | Autonomous system (AS) name. |
55+
| Last_Seen | Proxy last seen in days. |
56+
| Threat | Security threat reported. |
57+
| Proxy_Type | Type of proxy. |
58+
| Provider | Name of VPN provider if available. |
59+
```

docs/source/conf.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
# Read https://www.sphinx-doc.org/en/master/usage/configuration.html for more options available
3+
4+
# -- Project information
5+
6+
project = 'IP2Proxy .NET'
7+
copyright = '2024, IP2Location'
8+
author = 'IP2Location'
9+
10+
release = '0.1.0'
11+
version = '0.1.0'
12+
13+
# -- General configuration
14+
15+
extensions = [
16+
'sphinx.ext.duration',
17+
'sphinx.ext.doctest',
18+
'myst_parser',
19+
'sphinx_copybutton',
20+
]
21+
22+
# https://myst-parser.readthedocs.io/en/latest/syntax/optional.html
23+
24+
myst_enable_extensions = [
25+
"colon_fence",
26+
"deflist",
27+
"fieldlist",
28+
]
29+
30+
# https://myst-parser.readthedocs.io/en/latest/configuration.html#setting-html-metadata
31+
myst_html_meta = {
32+
"description": "IP2Proxy .NET Component enables user to query an IP address if it was being used as open proxy, web proxy, VPN anonymizer and TOR exits.",
33+
"keywords": "IP2Proxy, Proxy, IP location, .NET",
34+
"google-site-verification": "DeW6mXDyMnMt4i61ZJBNuoADPimo5266DKob7Z7d6i4",
35+
}
36+
37+
# templates_path = ['_templates']
38+
39+
# -- Options for HTML output
40+
41+
html_theme = 'sphinx_book_theme'
42+
43+
html_theme_options = {
44+
"use_edit_page_button": False,
45+
"use_source_button": False,
46+
"use_issues_button": False,
47+
"use_download_button": False,
48+
"use_sidenotes": False,
49+
}
50+
51+
# The name of an image file (relative to this directory) to place at the top
52+
# of the sidebar.
53+
html_logo = 'images/ipl-logo-square-1200.png'
54+
55+
# Favicon
56+
html_favicon = 'images/favicon.ico'
57+
58+
html_title = "IP2Proxy .NET"
59+
60+
# html_baseurl = "https://ip2proxy-go.readthedocs.io/en/latest/"

docs/source/images/favicon.ico

14.7 KB
Binary file not shown.
19.8 KB
Loading

docs/source/index.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# IP2Proxy .NET Component
2+
3+
This component 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
4+
5+
* Free IP2Proxy BIN Data: https://lite.ip2location.com
6+
* Commercial IP2Proxy BIN Data: https://www.ip2location.com/database/ip2proxy
7+
8+
9+
## Table of contents
10+
```{eval-rst}
11+
.. toctree::
12+
13+
self
14+
quickstart
15+
code
16+
```

docs/source/quickstart.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Quickstart
2+
3+
## Requirements
4+
5+
Microsoft .NET 4.72 framework or later.
6+
Compatible with .NET Core 2.x/3.x SDK.
7+
Compatible with .NET 5/6/7.
8+
9+
## Dependencies
10+
11+
This library requires IP2Proxy BIN database to function. You may download the BIN database at
12+
13+
- IP2Proxy LITE BIN Data (Free): <https://lite.ip2location.com>
14+
- IP2Proxy Commercial BIN Data (Comprehensive):
15+
<https://www.ip2location.com>
16+
17+
## Sample Codes
18+
19+
### Query geolocation information from BIN database
20+
21+
You can query the geolocation information from the IP2Proxy BIN database as below:
22+
23+
```vb.net
24+
Dim proxy As New IP2Proxy.Component
25+
Dim all As IP2Proxy.ProxyResult
26+
27+
Dim isproxy As Integer
28+
Dim proxytype As String
29+
Dim countryshort As String
30+
Dim countrylong As String
31+
Dim region As String
32+
Dim city As String
33+
Dim isp As String
34+
Dim domain As String
35+
Dim usagetype As String
36+
Dim asn As String
37+
Dim [as] As String
38+
Dim lastseen As String
39+
Dim threat As String
40+
Dim provider As String
41+
42+
Dim ip As String = "221.121.146.0"
43+
44+
If proxy.Open("C:\data\IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL-PROVIDER.BIN", IP2Proxy.Component.IOModes.IP2PROXY_MEMORY_MAPPED) = 0 Then
45+
Console.WriteLine("GetModuleVersion: " & proxy.GetModuleVersion())
46+
Console.WriteLine("GetPackageVersion: " & proxy.GetPackageVersion())
47+
Console.WriteLine("GetDatabaseVersion: " & proxy.GetDatabaseVersion())
48+
49+
' reading all available fields
50+
all = proxy.GetAll(ip)
51+
Console.WriteLine("Is_Proxy: " & all.Is_Proxy.ToString())
52+
Console.WriteLine("Proxy_Type: " & all.Proxy_Type)
53+
Console.WriteLine("Country_Short: " & all.Country_Short)
54+
Console.WriteLine("Country_Long: " & all.Country_Long)
55+
Console.WriteLine("Region: " & all.Region)
56+
Console.WriteLine("City: " & all.City)
57+
Console.WriteLine("ISP: " & all.ISP)
58+
Console.WriteLine("Domain: " & all.Domain)
59+
Console.WriteLine("Usage_Type: " & all.Usage_Type)
60+
Console.WriteLine("ASN: " & all.ASN)
61+
Console.WriteLine("AS: " & all.AS)
62+
Console.WriteLine("Last_Seen: " & all.Last_Seen)
63+
Console.WriteLine("Threat: " & all.Threat)
64+
Console.WriteLine("Provider: " & all.Provider)
65+
66+
' reading individual fields
67+
isproxy = proxy.IsProxy(ip)
68+
Console.WriteLine("Is_Proxy: " & isproxy.ToString())
69+
70+
proxytype = proxy.GetProxyType(ip)
71+
Console.WriteLine("Proxy_Type: " & proxytype)
72+
73+
countryshort = proxy.GetCountryShort(ip)
74+
Console.WriteLine("Country_Short: " & countryshort)
75+
76+
countrylong = proxy.GetCountryLong(ip)
77+
Console.WriteLine("Country_Long: " & countrylong)
78+
79+
region = proxy.GetRegion(ip)
80+
Console.WriteLine("Region: " & region)
81+
82+
city = proxy.GetCity(ip)
83+
Console.WriteLine("City: " & city)
84+
85+
isp = proxy.GetISP(ip)
86+
Console.WriteLine("ISP: " & isp)
87+
88+
domain = proxy.GetDomain(ip)
89+
Console.WriteLine("Domain: " & domain)
90+
91+
usagetype = proxy.GetUsageType(ip)
92+
Console.WriteLine("Usage_Type: " & usagetype)
93+
94+
asn = proxy.GetASN(ip)
95+
Console.WriteLine("ASN: " & asn)
96+
97+
[as] = proxy.GetAS(ip)
98+
Console.WriteLine("AS: " & [as])
99+
100+
lastseen = proxy.GetLastSeen(ip)
101+
Console.WriteLine("Last_Seen: " & lastseen)
102+
103+
threat = proxy.GetThreat(ip)
104+
Console.WriteLine("Threat: " & threat)
105+
106+
provider = proxy.GetProvider(ip)
107+
Console.WriteLine("Provider: " & provider)
108+
Else
109+
Console.WriteLine("Error reading BIN file.")
110+
End If
111+
proxy.Close()
112+
```

0 commit comments

Comments
 (0)