fast forward proxy tunnel
Project description
ProxyTunnel Wrapper
A Python wrapper for proxytunnel.exe that automatically manages the executable and provides a simple interface for port forwarding.
Installation
pip install proxytunnel
Features
- Automatic download and management of proxytunnel.exe
- Simple Python interface for port forwarding
- Automatic cleanup of processes
- Find available ports automatically
- Process status monitoring
- Windows support
- Background process management
Usage
Basic Port Forwarding
from proxytunnel import ProxyTunnel
# Create a ProxyTunnel instance
# This will automatically download proxytunnel.exe if it's not present
proxy = ProxyTunnel()
# Forward local port 8080 to remote proxy example.com:3128
process = proxy.forward(local_port=8080, remote_proxy="user:pass@example.com:3128")
# The process runs in the background
# To stop it:
process.terminate()
Finding Available Ports
from proxytunnel import ProxyTunnel
proxy = ProxyTunnel()
# Get a random available port
free_port = proxy.free_port()
print(f"Found available port: {free_port}")
# Use the free port for forwarding
process = proxy.forward(local_port=free_port, remote_proxy="http://user:pass@example.com:3128")
Process Management
from proxytunnel import ProxyTunnel
proxy = ProxyTunnel()
process = proxy.forward(local_port=8080, remote_proxy="http://user:pass@example.com:3128")
# Check if the process is running
if proxy.is_running():
print("Proxy tunnel is active")
# Kill the process
proxy.kill()
# Verify process is stopped
if not proxy.is_running():
print("Proxy tunnel is stopped")
Automatic Cleanup
The ProxyTunnel wrapper automatically handles process cleanup:
- When the ProxyTunnel object is destroyed
- When the program exits
- When starting a new forward process (kills existing process)
from proxytunnel import ProxyTunnel
# Create proxy instance
proxy = ProxyTunnel()
# Start forwarding
process1 = proxy.forward(local_port=8080, remote_proxy="example.com:3128")
# Starting another forward will automatically kill the previous process
process2 = proxy.forward(local_port=8081, remote_proxy="example.com:3128")
# No need to manually clean up - it's handled automatically when:
# - The program exits
# - The proxy object is destroyed
# - A new forward process is started
Requirements
- Python 3.6 or higher
- Windows operating system
- Internet connection (for downloading proxytunnel.exe)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
proxytunnel-0.1.1.tar.gz
(4.8 kB
view details)
Built Distribution
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 proxytunnel-0.1.1.tar.gz.
File metadata
- Download URL: proxytunnel-0.1.1.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba974900b2031ec58216f915cdd3d796630765ea27db4909714694e59dbe4141
|
|
| MD5 |
7550ee6d9b6bc8acefa4068dbdaf1127
|
|
| BLAKE2b-256 |
67c220d7d54aeba6e4ed325d8fdeb0336a64e55a58be7c5b885f03713df91282
|
File details
Details for the file proxytunnel-0.1.1-py3-none-any.whl.
File metadata
- Download URL: proxytunnel-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed3b53ceb13483d7839fbd72943d34e9a545f35a554bb78f4d4506bb1fee6d33
|
|
| MD5 |
93a948e19d04f9f30c2c31275dbe5b84
|
|
| BLAKE2b-256 |
347daf24a36c84a876e162dab402fd4aab275f77822e381382bee6b31f9fb435
|