PProxy: Advanced Python Async Proxy for All Protocols
PProxy: Your Comprehensive Python-Powered Asynchronous Proxy Solution
In today's interconnected world, managing network traffic with flexibility, security, and efficiency is paramount. PProxy emerges as a robust, open-source asynchronous tunnel proxy, meticulously implemented in Python 3 with asyncio
. This project is designed to handle a diverse range of protocols for both TCP and UDP, making it an indispensable tool for developers, network administrators, and anyone seeking advanced proxy capabilities.
What is PProxy?
PProxy is a lightweight yet powerful solution for creating and managing various types of network proxies. Its core strength lies in its asynchronous asyncio
implementation, allowing it to efficiently handle multiple connections without blocking. This project stands out for its extensive protocol support, including:
- HTTP/HTTP2/HTTP3: Standard web proxying.
- Socks4/Socks5: Widely used for general-purpose proxying.
- Shadowsocks/ShadowsocksR: Secure and obfuscated proxying often used for bypassing censorship.
- SSH: Secure shell tunneling for encrypted connections.
- Redirect/Pf: For NAT and firewall rule-based redirection.
- QUIC: The new UDP-based transport protocol for low-latency connections.
Key Features at a Glance
PProxy is packed with features designed to offer maximum control and versatility:
- Lightweight & Pure Python: No external libraries required by default, ensuring easy deployment.
- Asynchronous I/O: Single-threaded
asyncio
for high performance. - Client/Server Support: Acts as both a proxy client and server for TCP/UDP connections.
- Load Balancing: Schedule connections across multiple remote servers using algorithms like round-robin, random choice, and least connection.
- Automatic Traffic Detection: Intelligently identifies incoming proxy protocols.
- Tunneling & Jumping: Supports complex multi-hop proxy chains.
- Authentication: User/password authentication for enhanced security.
- Filtering: Block hostnames using regex patterns.
- SSL/TLS Support: Encrypt connections with SSL/TLS for secure communication.
- System-Wide Proxy Setting: Conveniently apply proxy settings across macOS and Windows systems.
- Docker Integration: Easily deployable via provided Docker images (Python3 and PyPy).
- API: Offers both TCP and UDP client APIs, as well as a robust server API for programmatic control.
Getting Started with PProxy
Setting up PProxy is straightforward. You can install it directly via pip:
$ pip3 install pproxy
For improved performance, especially with ciphers, an accelerated version is available:
$ pip3 install pproxy[accelerated]
Basic Usage Example:
To run a basic HTTP/Socks proxy on port 8080:
$ pproxy
Serving on :8080 by http,socks4,socks5
Shadowsocks Example:
Start a Shadowsocks proxy with a specific cipher and key:
$ pproxy -l ss://chacha20:your_secret_key@:8080
Docker Deployment:
Leverage Docker for isolated and reproducible deployments:
docker run -it -p 8080:8080 mosajjal/pproxy:latest -l http://:8080 -vv
Advanced Configurations and Use Cases
PProxy's power truly shines in its advanced configurations. You can chain proxies, apply regex-based routing rules, set up SSL/TLS servers, and even implement backward proxying. The detailed documentation on its GitHub repository provides extensive examples for nearly every imaginable scenario.
From enabling secure communication through multiple proxy jumps (http://server1__ss://server2__socks://server3
) to setting up specific DNS tunnels (pproxy -ul tunnel{8.8.8.8}://:53
), PProxy offers the flexibility needed for complex network architectures.
Performance Considerations
While PProxy is pure Python, it offers competitive performance. For demanding high-throughput scenarios, integrating pycryptodome
for C-based ciphers provides significant speed improvements. Furthermore, running PProxy with PyPy can drastically boost the performance of pure Python ciphers, often achieving speeds comparable to C implementations.
Conclusion
PProxy is an exemplary open-source project that delivers a comprehensive, flexible, and powerful asynchronous proxy solution. Whether you need to secure your internet traffic, bypass geo-restrictions, or design intricate network tunneling configurations, PProxy provides the tools and control necessary to achieve your goals. Its active development and detailed documentation make it an excellent choice for a wide range of use cases.