PyRathole
Python bindings for rathole, a high-performance reverse tunnelling proxy.
🚀 Quick Start
Installation
pip install pyrathole
Basic Usage
import pyrathole
# Start rathole server
pyrathole.start_server("/path/to/server.toml")
# Start rathole client
pyrathole.start_client("/path/to/client.toml")
# Get rathole version
version = pyrathole.version()
print(f"Rathole version: {version}")
Note: This package requires rathole to be installed on your system. Download from rathole releases.
📋 Requirements
- Python 3.8+
- rathole binary installed on your system
- Valid rathole configuration files
🔧 Installing rathole Binary
Before using PyRathole, you need to install the rathole binary on your system:
Option 1: Download Pre-built Binaries (Recommended)
-
Go to rathole releases
-
Download the appropriate binary for your system:
- Linux:
rathole-x86_64-unknown-linux-gnu.tar.gz - macOS:
rathole-x86_64-apple-darwin.tar.gzorrathole-aarch64-apple-darwin.tar.gz - Windows:
rathole-x86_64-pc-windows-gnu.zip
- Linux:
-
Extract and install:
# Linux/macOS tar -xzf rathole-*.tar.gz sudo mv rathole /usr/local/bin/ # Windows # Extract the zip file and add the directory to your PATH
Option 2: Install via Package Manager
macOS (Homebrew)
brew install rathole
Arch Linux
sudo pacman -S rathole
Ubuntu/Debian (via cargo)
cargo install rathole
Option 3: Build from Source
git clone https://github.com/rapiz1/rathole.git
cd rathole
cargo build --release
sudo cp target/release/rathole /usr/local/bin/
Verify Installation
rathole --version
This should output the rathole version number.
⚙️ Configuration
PyRathole uses the same configuration format as native rathole. See the rathole documentation for detailed configuration options.
Example Server Config (server.toml)
[server]
bind_addr = "0.0.0.0:2333"
[server.services.web]
type = "tcp"
bind_addr = "0.0.0.0:8080"
token = "your-secret-token"
Example Client Config (client.toml)
[client]
remote_addr = "your.server.com:2333"
[client.services.web]
type = "tcp"
local_addr = "127.0.0.1:8080"
token = "your-secret-token"
🔧 API Reference
Functions
start_server(config_path: str)- Start rathole server with given config filestart_client(config_path: str)- Start rathole client with given config fileversion() -> str- Get installed rathole version
Error Handling
import pyrathole
try:
pyrathole.start_server("server.toml")
except RuntimeError as e:
print(f"Failed to start server: {e}")
🐛 Troubleshooting
| Error | Cause | Solution |
|---|---|---|
RuntimeError: Failed to start rathole |
rathole not found in PATH | Install rathole binary and ensure it's in your PATH |
RuntimeError: Rathole failed |
Invalid config or network issues | Check configuration file and network connectivity |
RuntimeError: Failed to get version |
rathole not installed | Ensure rathole is properly installed and accessible |
command not found: rathole |
rathole not in PATH | Add rathole to your system PATH or install it properly |
| Permission denied | Insufficient permissions | Use sudo for system-wide installation or install to user directory |
Common Installation Issues
Linux/macOS:
# Check if rathole is installed
which rathole
# If not found, add to PATH
export PATH="/usr/local/bin:$PATH"
Windows:
- Ensure rathole.exe is in a directory that's in your PATH
- Or add the rathole directory to your system PATH environment variable
📚 Documentation
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
📄 License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
🙏 Acknowledgments
Metadata
Release files for pyrathole 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyrathole-0.1.2.tar.gz | 98.2 MB | Without provenance | Details for pyrathole-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyrathole-0.1.2-cp312-cp312-macosx_10_12_x86_64.whl | CPython 3.12 | CPython 3.12 | macOS 10.12+ x86-64 | Details for pyrathole-0.1.2-cp312-cp312-macosx_10_12_x86_64.whl |
Total release size: 98.4 MB
Release files / pyrathole-0.1.2.tar.gz
| Download URL | pyrathole-0.1.2.tar.gz |
|---|---|
| Size | 98.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
78f8035e81b62bcb200784c96f6e8e8c44ed713e5fd9d4d646e3308b18a606f6
|
|
BLAKE2b-256 checksum How to use checksums |
9c509a6a0a08fcf8c30f7c9df39e74caafab6c9324bd3a18b1dffeb1b04a9328
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.4
|
Release files / pyrathole-0.1.2-cp312-cp312-macosx_10_12_x86_64.whl
| Download URL | pyrathole-0.1.2-cp312-cp312-macosx_10_12_x86_64.whl |
|---|---|
| Size | 205.3 kB |
| Tags | CPython 3.12 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
c0d3fe95d5e0424884a1cf1c47970e7f40b2c1de88727e7c1a1fa4f7352c8042
|
|
BLAKE2b-256 checksum How to use checksums |
8320ad1918c05d25b5b339593e9e39e660a99925088e60886b7285f2eda6d60a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.4
|
Security for pyrathole 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.