diff options
| author | 2024-03-20 21:48:45 +0100 | |
|---|---|---|
| committer | 2024-03-20 21:48:45 +0100 | |
| commit | 486087cdb349dbc07b479d2286a02bdca310ea38 (patch) | |
| tree | 43f7baed542a1bc819884ddeebc6e15dfcbd42b0 /ttun_server/__init__.py | |
| parent | 53a8f300859a50d9f99f1821c35bca999fced6d8 (diff) | |
| download | server-486087cdb349dbc07b479d2286a02bdca310ea38.tar.gz server-486087cdb349dbc07b479d2286a02bdca310ea38.tar.bz2 server-486087cdb349dbc07b479d2286a02bdca310ea38.zip | |
Added websocket support
Diffstat (limited to 'ttun_server/__init__.py')
| -rw-r--r-- | ttun_server/__init__.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ttun_server/__init__.py b/ttun_server/__init__.py index 81f8cd4..2f8fed0 100644 --- a/ttun_server/__init__.py +++ b/ttun_server/__init__.py | |||
| @@ -4,7 +4,8 @@ import os | |||
| 4 | from starlette.applications import Starlette | 4 | from starlette.applications import Starlette |
| 5 | from starlette.routing import Route, WebSocketRoute, Host, Router | 5 | from starlette.routing import Route, WebSocketRoute, Host, Router |
| 6 | 6 | ||
| 7 | from ttun_server.endpoints import Proxy, Tunnel, Health | 7 | from ttun_server.endpoints import Proxy, Health |
| 8 | from .websockets import WebsocketProxy, Tunnel | ||
| 8 | 9 | ||
| 9 | logging.basicConfig(level=getattr(logging, os.environ.get('LOG_LEVEL', 'INFO'))) | 10 | logging.basicConfig(level=getattr(logging, os.environ.get('LOG_LEVEL', 'INFO'))) |
| 10 | 11 | ||
| @@ -18,6 +19,7 @@ server = Starlette( | |||
| 18 | routes=[ | 19 | routes=[ |
| 19 | Host(os.environ['TUNNEL_DOMAIN'], base_router, 'base'), | 20 | Host(os.environ['TUNNEL_DOMAIN'], base_router, 'base'), |
| 20 | Route('/{path:path}', Proxy), | 21 | Route('/{path:path}', Proxy), |
| 22 | WebSocketRoute('/{path:path}', WebsocketProxy) | ||
| 21 | ] | 23 | ] |
| 22 | ) | 24 | ) |
| 23 | 25 | ||
