Tunneling tool
Project description
Pinggy
A powerful Python library for creating and managing network tunnels with easy-to-use functionality for HTTP, TCP, TLS, and UDP tunneling.
Pinggy is a versatile library designed for creating secure tunnels between local and remote servers. It supports HTTP, TCP, TLS, and UDP tunneling, making it ideal for use cases such as port forwarding, secure connections, multi-port tunneling, and advanced debugging. With support for authentication, advanced configuration, and error handling, Pinggy is an excellent choice for network diagnostics, server debugging, and remote access tasks.
Features
- Supports multiple tunneling protocols: HTTP, TCP, TLS, and UDP.
- Comprehensive event handling: Extend
BaseTunnelHandlerfor custom authentication, connection, forwarding, and error events. - Multi-port forwarding: Easily manage primary and additional port forwarding requests.
- Authentication support: Includes Basic Authentication, Bearer Authentication, and IP whitelisting.
- Web Debugger: Start a web debugger on a custom port to capture tunnel traffic.
- Header modification: Add, remove, or update request headers dynamically.
- Reverse Proxy & TLS: Enable/disable reverse proxy mode and local server TLS (with SNI support).
- Asynchronous Operation: Manage tunnels without blocking other operations.
- Simple API: Create, configure, and manage tunnels with just a few lines of code.
Installation
To install Pinggy, simply run:
pip install pinggy
Quick Start Guide
Use the start_tunnel function to quickly set up and start a tunnel with minimal code.
Example 1: Start an HTTP Tunnel (Basic Usage)
import pinggy
# Start an HTTP tunnel forwarding traffic to localhost on port 8080
tunnel = pinggy.start_tunnel(forwardto="localhost:8080", token="your_token_here")
print(f"Tunnel started with token: {tunnel.token}")
Example 2: Start a TCP Tunnel with Custom Authentication and IP Whitelisting
import pinggy
tunnel = pinggy.start_tunnel(
forwardto="localhost:80",
token="your_token_here",
force=True,
ipwhitelist=["192.168.1.100", "23.15.30.223"],
type="tcp"
)
print(f"TCP Tunnel started at {tunnel.server_address} with token: {tunnel.token}")
Example 3: Start a UDP Tunnel with Web Debugger
import pinggy
tunnel = pinggy.start_tunnel(
forwardto="localhost:53",
token="your_token_here",
type="udp",
webdebuggerport=4300
)
print(f"UDP Tunnel started with web debugger at port 4300")
Example 4: Advanced Configuration (TLS, Headers, Reverse Proxy)
import pinggy
tunnel = pinggy.start_tunnel(
forwardto="localhost:443",
token="your_token_here",
type="tls",
localservertls=True, # Enable TLS for local server
headermodification=[{"type": "remove", "key": "Accept"}, {"type": "update", "key": "UserAgent", "value" :["PinggyTestServer 1.2.3"]}],
reverseproxy=False
)
print(f"TLS Tunnel started with custom headers and reverse proxy disabled.")
Key Methods & Properties
start_tunnel(): Starts a tunnel with the provided configuration and options (type, token, port forwarding, TLS, authentication, etc.).start_udptunnel(): Starts a UDP tunnel with similar configuration options.Tunnel.start(): Starts the tunnel in a blocking manner.Tunnel.connect(): Connects the tunnel and performs authentication.Tunnel.request_primary_forwarding(): Requests the primary forwarding for the tunnel.Tunnel.request_additional_forwarding(): Adds additional port forwarding after the primary forwarding is complete.Tunnel.stop(): Stops the tunnel.Tunnel.is_active(): Checks if the tunnel is currently active.Tunnel.urls: Lists public URLs for the running tunnel.Tunnel.xff,Tunnel.httpsonly,Tunnel.fullrequesturl,Tunnel.allowpreflight,Tunnel.reverseproxy,Tunnel.localservertls,Tunnel.headermodification,Tunnel.basicauth,Tunnel.bearerauth,Tunnel.ipwhitelist,Tunnel.token,Tunnel.type,Tunnel.tcp_forward_to,Tunnel.udp_forward_to,Tunnel.sni_server_name,Tunnel.force,Tunnel.argument.
Advanced Features
- Web Debugger: Start a debugger on a custom port to inspect tunnel traffic.
- Authentication Options: Use basic authentication, bearer tokens, or IP whitelisting for secure access.
- Reverse Proxy & TLS: Enable/disable reverse proxy mode and local server TLS (with SNI support).
- Header Modification: Add, remove, or update request headers dynamically.
- Multi-port Forwarding: Easily manage primary and additional port forwarding requests.
- Comprehensive Event Handling: Extend
BaseTunnelHandlerfor custom event handling (authentication, forwarding, errors, etc.).
Documentation
For more details on usage and configuration, visit the full documentation at https://pinggy.io/docs.
Contributing
We welcome contributions to the Pinggy library! Feel free to fork the repository, report bugs, or submit pull requests.
License
Pinggy is licensed under the MIT License. See the LICENSE file for more information.
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 Distributions
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 pinggy-0.0.20-cp310-abi3-win_arm64.whl.
File metadata
- Download URL: pinggy-0.0.20-cp310-abi3-win_arm64.whl
- Upload date:
- Size: 2.9 MB
- Tags: CPython 3.10+, Windows ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2aff708d57520ef4b9112258e60b9e73ed8fc0c90e6add36f66ec0f390516fee
|
|
| MD5 |
5311185275b3e3e90edc3065f809b00f
|
|
| BLAKE2b-256 |
8af4eac081f8f88777a26fe3a2cd12d663c0f5aeb2e719ab141ca78c50409e43
|
File details
Details for the file pinggy-0.0.20-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: pinggy-0.0.20-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4dc7c21485d1d296fe26a4aee3d263a74d9e7b2d642c08ef8011fcec92924bdb
|
|
| MD5 |
347186e5e4e7af9d9dd9cfd127e2b786
|
|
| BLAKE2b-256 |
5e548245f2c90589f4d4ab089fd7f955a6b0156eeac084fcae73a9e8cf2420f7
|
File details
Details for the file pinggy-0.0.20-cp310-abi3-win32.whl.
File metadata
- Download URL: pinggy-0.0.20-cp310-abi3-win32.whl
- Upload date:
- Size: 6.2 MB
- Tags: CPython 3.10+, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcb862e2b4f1694aa473ce4a3baa071a1b15b3df9fea7475f13693e6d1642bf7
|
|
| MD5 |
d2b4c5ff35a59df07f6fb1d924202995
|
|
| BLAKE2b-256 |
4fe959c1a223460ea0a7e2fd327533a9f6cfa9615e4fd10e9b30cdd4b65b9353
|
File details
Details for the file pinggy-0.0.20-cp310-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pinggy-0.0.20-cp310-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 6.2 MB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee32e0d4a47cbea263bd5d6f8d66088b010f9eea0d37ef1c786a2330326ebec8
|
|
| MD5 |
d9744de9c593439669aee5e2fa1fe4b0
|
|
| BLAKE2b-256 |
ff31b2d3390d87b055055d5332fe5b1f0e7a5d5f9b1ea104ab7ef3043713b684
|
File details
Details for the file pinggy-0.0.20-cp310-abi3-manylinux_2_28_i686.whl.
File metadata
- Download URL: pinggy-0.0.20-cp310-abi3-manylinux_2_28_i686.whl
- Upload date:
- Size: 6.3 MB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6d05f1c8fdac4088f4bceaf2ae0d4e79bffa048c60a812ba8413cbb6a532bf3
|
|
| MD5 |
abf0581644eafd7f5a46cfd48b8ece03
|
|
| BLAKE2b-256 |
6395976638cafef2c3c554843304b46e50916dac00018c389520eff45bb8b24d
|
File details
Details for the file pinggy-0.0.20-cp310-abi3-manylinux_2_28_armv7l.whl.
File metadata
- Download URL: pinggy-0.0.20-cp310-abi3-manylinux_2_28_armv7l.whl
- Upload date:
- Size: 5.2 MB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e9351aa807c0e5b6a4a9a8e1f86f5c08d677d2b57477b400270d1d7b8811c14
|
|
| MD5 |
cef0159d6f76e880c1fcdd416aeabab0
|
|
| BLAKE2b-256 |
c737f9e07c4762ec1b85a2f1c6437b4293a6227e7a5e8184f620923bde0d880d
|
File details
Details for the file pinggy-0.0.20-cp310-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: pinggy-0.0.20-cp310-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 6.9 MB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f86b9c922f652f12ec19266c5ae57e5a770c1ac7cd639a561a9b046580542b9d
|
|
| MD5 |
c30231554498a1a792c003017dde1129
|
|
| BLAKE2b-256 |
c5a2ed020e1c3cbe9043342eeba5f001288a2d18735f12b5e34aba17635337fc
|
File details
Details for the file pinggy-0.0.20-cp310-abi3-macosx_11_0_universal2.whl.
File metadata
- Download URL: pinggy-0.0.20-cp310-abi3-macosx_11_0_universal2.whl
- Upload date:
- Size: 10.6 MB
- Tags: CPython 3.10+, macOS 11.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26a387d9a5f3cb56afe6a4e08161813d0216acdf94ca5f8f94f978703568829c
|
|
| MD5 |
cadacf7ed440915e8c34d669beb4ab62
|
|
| BLAKE2b-256 |
2e2ff5483358e98ddbbc125540d9caeaa1a210598ea460f17de7783c944f11cc
|