Skip to main content

WebSocket Tunnel - 透明反向代理隧道,支持服务端嵌入和客户端 SDK

Project description

WS-Tunnel Python SDK

WebSocket 透明反向代理隧道 - Python 服务端和客户端 SDK。

详见上级目录的 README.md

安装

pip install -e .

使用

服务端

from fastapi import FastAPI
from ws_tunnel import TunnelServer, TunnelServerConfig

app = FastAPI()
tunnel_server = TunnelServer()
app.include_router(tunnel_server.router)

@app.on_event("startup")
async def startup():
    await tunnel_server.initialize()

客户端

from ws_tunnel import TunnelClient

client = TunnelClient(
    server_url="ws://server/ws/tunnel",
    token="tun_xxx",
    target_url="http://localhost:8080"
)
await client.run()

命令行

ws-tunnel connect --token tun_xxx --target http://localhost:8080

Project details


Download files

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

Source Distribution

tunely-0.1.0.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

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

tunely-0.1.0-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file tunely-0.1.0.tar.gz.

File metadata

  • Download URL: tunely-0.1.0.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for tunely-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d0009c6053ef6ec9c6a05c93a9647ecc5407f4c6c53cae77c3f7bde98898399b
MD5 82fce0ff560df0446563d2730066d7c9
BLAKE2b-256 a96008949f861775a804acffc567c17f4c98b19d0beb0c5ab949db06dee5e249

See more details on using hashes here.

File details

Details for the file tunely-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tunely-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for tunely-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f0eda07b4dc8e530409dfded0ca985281e6d2d1ed5613e33fe34bd6729a8cea
MD5 2631c5e54222d1603d42c50fa4e03e02
BLAKE2b-256 34e9686f59ea599abb6b061ecdfa5b92f2784e4e09392a46a6ad5a8cd1ae3b27

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