Python SDK for outray.dev tunneling service
Project description
# Outray
`outray` is a Python library for creating **HTTP, TCP, and UDP tunnels** using (https://outray.dev/)[https://outray.dev/]. It allows you to forward local services to a remote endpoint easily.
Install via pip:
```bash
pip install outray
Features
- HTTP tunnel proxy (
HttpListener) - TCP tunnel proxy (
TCPListener) - UDP tunnel proxy (
UDPListener) - Forward a tunnel asynchronously or synchronously
- Built-in error handling and logging
Usage Example
- Asynchronous
import asyncio
from outray import forward, http
async def main():
listener = http("http://localhost:8080")
await forward(listener)
asyncio.run(main())
- Synchronous
import asyncio
from outray import forward, http
listener = http("http://localhost:8080")
forward_sync(listener)
API
Creating a Listener
TCP
from outray import tcp
listener = tcp(local_host="localhost", local_port=8090, remote_port=20710)
UDP
from outray import udp
listener = udp(local_host="localhost", local_port=9000, remote_port=30710)
HTTP
from outray import http
listener = http(url="http://localhost:8080", subdomain="my-subdomain")
Forwarding a Tunnel
Asynchronous (forward)
from outray import forward
import asyncio
asyncio.run(forward(listener))
forward(listener, ws_url=None, force_takeover=None, ping_interval=20, ping_timeout=20, api_key=None)- Forwards the listener to the remote WebSocket tunnel.
- Handles reconnects automatically.
Synchronous (forward_sync)
from outray import forward_sync
forward_sync(listener)
- Same as
forwardbut runs in a blocking synchronous context. - Useful for scripts that do not use
asyncionatively.
Logging
outray uses the standard Python logging module. To see detailed tunnel events:
import logging
logger = logging.getLogger("outray")
logger.setLevel(logging.DEBUG)
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
outray-0.0.1.tar.gz
(11.7 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
outray-0.0.1-py3-none-any.whl
(11.5 kB
view details)
File details
Details for the file outray-0.0.1.tar.gz.
File metadata
- Download URL: outray-0.0.1.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4bca45cc507cc60cb0a34015f0d026a420137651c53d3550c408d5537fb50d5
|
|
| MD5 |
ddf3eeb5fa687b2da65cd2cb4fa5ae58
|
|
| BLAKE2b-256 |
32bb842640059370a4dda0412cdfe22da54e4bff2f24319759d3f92d3c3cc6dc
|
File details
Details for the file outray-0.0.1-py3-none-any.whl.
File metadata
- Download URL: outray-0.0.1-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3cbd1d4666acbca028b6054e4752bf2cd10d268a2cebd0a6812513fb4cb926da
|
|
| MD5 |
ab739d45d08a778b1eb422a17564d902
|
|
| BLAKE2b-256 |
608822ce65f241c99d85eb18ed9f1c23fa4e196a176f89f632bea08255f3b8c2
|