I2P Proxy Tunnel with Python decorator support
Project description
I2P Tunnel
A Rust daemon with extensive logging that manages I2P HTTPS proxies, tests them in parallel for download speed, selects the fastest one, and provides a Python decorator interface for automatic request proxying.
Features
- Fetches proxy list from
http://outproxys.i2p/ - Tests proxies in parallel for download speed
- Automatically selects and uses the fastest proxy
- Python decorator
@i2pfor seamless integration - Comprehensive logging with
tracing - Automatic proxy rotation on failure
- Periodic re-testing to maintain optimal performance
Installation
Prerequisites
- Rust (latest stable version)
- Python 3.8+
- uv (fast Python package installer)
Install uv:
# On Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
# On macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
Build
Build the Rust library and Python extension using uv:
# Install maturin using uv
uv tool install maturin
# Build and install in development mode
uv run maturin develop --release
# Or build wheel and install
uv run maturin build --release
uv pip install target/wheels/i2ptunnel-*.whl
Or use uv's project management:
# Sync dependencies and build
uv sync
uv run maturin develop --release
Usage
Python Decorator
Use the @i2p decorator to automatically route HTTP requests through the fastest I2P proxy:
from i2p_proxy import i2p
import requests
@i2p
def fetch_data():
response = requests.get("https://example.com")
return response.json()
# All requests.get/post/etc. calls inside this function
# will automatically use the fastest I2P proxy
data = fetch_data()
Direct Usage
You can also use the daemon directly:
from i2ptunnel import I2PProxyDaemon
daemon = I2PProxyDaemon()
# Fetch available proxies
proxies = daemon.fetch_proxies()
print(f"Found {len(proxies)} proxies")
# Test proxies
results = daemon.test_proxies(proxies[:5]) # Test first 5
for result in results:
if result["success"]:
print(f"Proxy {result['proxy']}: {result['speed_bytes_per_sec']/1024:.2f} KB/s")
# Make a request through the fastest proxy
response = daemon.make_request(
url="https://example.com",
method="GET",
headers=None,
body=None
)
print(f"Status: {response['status']}")
print(f"Proxy used: {response['proxy_used']}")
print(f"Body: {response['body']}")
Using the I2PProxy class
from i2p_proxy import I2PProxy
proxy = I2PProxy()
# Make requests directly
response = proxy.get("https://example.com")
print(response.status_code)
print(response.text)
response = proxy.post("https://example.com/api", data=b"data")
Logging
The daemon uses extensive logging via the tracing crate. Set the log level with environment variables:
# Set log level (TRACE, DEBUG, INFO, WARN, ERROR)
export RUST_LOG=i2ptunnel=debug
# Or more verbose
export RUST_LOG=i2ptunnel=trace
Architecture
- ProxyManager: Fetches and parses proxy list from
http://outproxys.i2p/ - ProxyTester: Tests proxies in parallel, measuring download speed and latency
- ProxySelector: Tracks and selects the fastest proxy, handles failures
- RequestHandler: Routes HTTP requests through the selected proxy
- PyO3 Bridge: Exposes Rust functionality to Python
Configuration
The daemon automatically:
- Fetches proxies from the I2P outproxy list
- Tests proxies in parallel (up to 10 concurrent tests)
- Selects the fastest proxy based on download speed
- Re-tests proxies every 5 minutes (configurable)
- Rotates to a new proxy on failure
Development
Build for development:
cargo build
Run tests:
cargo test
Build Python extension in development mode:
uv run maturin develop
Or using uv sync:
uv sync
uv run maturin develop
License
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file i2ptunnel-0.1.0.tar.gz.
File metadata
- Download URL: i2ptunnel-0.1.0.tar.gz
- Upload date:
- Size: 32.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
694d98e4f196314cb0ded6e58dc1b16950f87f39123660a1c2cdca2f082aa25d
|
|
| MD5 |
8b5c7e0a39fa0b85b7802ceb48ef26dc
|
|
| BLAKE2b-256 |
7880fa0452b4863494f0bcf99dcd01144991e73e9c6a2168dfdf4a00e7d8a26c
|
Provenance
The following attestation bundles were made for i2ptunnel-0.1.0.tar.gz:
Publisher:
publish.yml on Krabbens/i2ptunnel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
i2ptunnel-0.1.0.tar.gz -
Subject digest:
694d98e4f196314cb0ded6e58dc1b16950f87f39123660a1c2cdca2f082aa25d - Sigstore transparency entry: 669275149
- Sigstore integration time:
-
Permalink:
Krabbens/i2ptunnel@e605576a71067268bce3fe6be8eef40a378be943 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Krabbens
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e605576a71067268bce3fe6be8eef40a378be943 -
Trigger Event:
release
-
Statement type:
File details
Details for the file i2ptunnel-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: i2ptunnel-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 5.9 MB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebf4b0abedb5f4c6871c78993a7dc163cd75f7bb25fc60c50a5816e4fe98790e
|
|
| MD5 |
e826d44ec484f65e8d8b87256afa0c5b
|
|
| BLAKE2b-256 |
0f8682f411bf8d00c11bff38276794c393aeb5d2efb831a0735109008fd1b6ed
|
Provenance
The following attestation bundles were made for i2ptunnel-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl:
Publisher:
publish.yml on Krabbens/i2ptunnel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
i2ptunnel-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl -
Subject digest:
ebf4b0abedb5f4c6871c78993a7dc163cd75f7bb25fc60c50a5816e4fe98790e - Sigstore transparency entry: 669275169
- Sigstore integration time:
-
Permalink:
Krabbens/i2ptunnel@e605576a71067268bce3fe6be8eef40a378be943 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Krabbens
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e605576a71067268bce3fe6be8eef40a378be943 -
Trigger Event:
release
-
Statement type:
File details
Details for the file i2ptunnel-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: i2ptunnel-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 5.9 MB
- Tags: CPython 3.11, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5f670dabcc16115f4a88c285649a7b83d9720697f90e4b2b785206a18fa5733
|
|
| MD5 |
945230a6b2c5d9312f10544a9fca7afe
|
|
| BLAKE2b-256 |
42565982e46ce3a3c81b41fa1d7f427b06bdeea9552f52068b1d181ddc63758a
|
Provenance
The following attestation bundles were made for i2ptunnel-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl:
Publisher:
publish.yml on Krabbens/i2ptunnel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
i2ptunnel-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl -
Subject digest:
e5f670dabcc16115f4a88c285649a7b83d9720697f90e4b2b785206a18fa5733 - Sigstore transparency entry: 669275160
- Sigstore integration time:
-
Permalink:
Krabbens/i2ptunnel@e605576a71067268bce3fe6be8eef40a378be943 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Krabbens
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e605576a71067268bce3fe6be8eef40a378be943 -
Trigger Event:
release
-
Statement type:
File details
Details for the file i2ptunnel-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: i2ptunnel-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 5.9 MB
- Tags: CPython 3.10, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c146efacf7fd8edef848f2ce3141cc0148525471f490025cd3f1ed75dc05bdf
|
|
| MD5 |
c050b8aa39145bf93ae41181cd0175f7
|
|
| BLAKE2b-256 |
8c8496cc02e086874360ce8ac0061ce64c9f1fc576f032be0782263356442f2d
|
Provenance
The following attestation bundles were made for i2ptunnel-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl:
Publisher:
publish.yml on Krabbens/i2ptunnel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
i2ptunnel-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl -
Subject digest:
0c146efacf7fd8edef848f2ce3141cc0148525471f490025cd3f1ed75dc05bdf - Sigstore transparency entry: 669275162
- Sigstore integration time:
-
Permalink:
Krabbens/i2ptunnel@e605576a71067268bce3fe6be8eef40a378be943 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Krabbens
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e605576a71067268bce3fe6be8eef40a378be943 -
Trigger Event:
release
-
Statement type:
File details
Details for the file i2ptunnel-0.1.0-cp39-cp39-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: i2ptunnel-0.1.0-cp39-cp39-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 5.9 MB
- Tags: CPython 3.9, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d06f1178d1e1a9cdb65ec13ed6113d661559e19540fdfaf739270b781c64660
|
|
| MD5 |
38720dd6c106587b968a0e0e0e989740
|
|
| BLAKE2b-256 |
410660ad91d3e9d1b51ad4ade0514e0d4aff8eefd964eee8c91475d3c73e9069
|
Provenance
The following attestation bundles were made for i2ptunnel-0.1.0-cp39-cp39-manylinux_2_34_x86_64.whl:
Publisher:
publish.yml on Krabbens/i2ptunnel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
i2ptunnel-0.1.0-cp39-cp39-manylinux_2_34_x86_64.whl -
Subject digest:
1d06f1178d1e1a9cdb65ec13ed6113d661559e19540fdfaf739270b781c64660 - Sigstore transparency entry: 669275166
- Sigstore integration time:
-
Permalink:
Krabbens/i2ptunnel@e605576a71067268bce3fe6be8eef40a378be943 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Krabbens
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e605576a71067268bce3fe6be8eef40a378be943 -
Trigger Event:
release
-
Statement type:
File details
Details for the file i2ptunnel-0.1.0-cp38-cp38-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: i2ptunnel-0.1.0-cp38-cp38-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 5.9 MB
- Tags: CPython 3.8, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf3205d5ea1cf83125d5c934cc3af38aa0ac569abd81fde96cfdb5f449077d84
|
|
| MD5 |
1fef18ed84019a05887fddb3e149d204
|
|
| BLAKE2b-256 |
0dd9184059f69488768db297f4ef8a1505768b923ed1a6bf62c15b62468d3a05
|
Provenance
The following attestation bundles were made for i2ptunnel-0.1.0-cp38-cp38-manylinux_2_34_x86_64.whl:
Publisher:
publish.yml on Krabbens/i2ptunnel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
i2ptunnel-0.1.0-cp38-cp38-manylinux_2_34_x86_64.whl -
Subject digest:
cf3205d5ea1cf83125d5c934cc3af38aa0ac569abd81fde96cfdb5f449077d84 - Sigstore transparency entry: 669275154
- Sigstore integration time:
-
Permalink:
Krabbens/i2ptunnel@e605576a71067268bce3fe6be8eef40a378be943 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Krabbens
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e605576a71067268bce3fe6be8eef40a378be943 -
Trigger Event:
release
-
Statement type: