Skip to main content

Python bindings for rathole reverse tunneling proxy

Project description

PyRathole

PyPI version Python 3.8+ License: Apache-2.0

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

⚙️ 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 file
  • start_client(config_path: str) - Start rathole client with given config file
  • version() -> 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 from releases
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

📚 Documentation

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

🙏 Acknowledgments

  • rathole - The amazing reverse tunneling proxy
  • PyO3 - Rust-Python bindings
  • maturin - Build tool for Python extensions

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyrathole-0.1.1-cp312-cp312-macosx_10_12_x86_64.whl (204.6 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

File details

Details for the file pyrathole-0.1.1-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pyrathole-0.1.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 69bc844626f212b77da4d2ac937d8110a00d738877d2fff06deb3231c9e207b6
MD5 c9227133ba3ec5f746653ef99cce1547
BLAKE2b-256 b0067e161a7f0f8cce6a154d4a2b4003604658e1d7bebe41fc774db2c0a65a70

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page