#tunnel #web #proxy #web-server #web-services

tinytun

在互联网上暴露本地Web服务器

2个不稳定版本

0.1.0 2023年5月4日
0.0.1 2023年5月1日

#57 in #tunnel

MIT许可证

10KB
221

tinytun

为本地运行的Web服务器生成公共URL。ngrok的简单克隆。

sequenceDiagram

participant Local WEB service
participant TinytunClient as Tinytun Client
participant TinytunServer as Tinytun Server
participant User as User outside<br/>of local network

box transparent Internal Network
    participant Local WEB service
    participant TinytunClient
end

box transparent External Network
    participant TinytunServer
    participant User
end

TinytunClient->>TinytunServer: Create tunnel via an HTTP request
TinytunServer->>TinytunClient: Tunnel created and the<br/>HTTP connection is "downgraded"<br/>to a simple TCP tunnel
note over TinytunClient,TinytunServer: Tinytun Client starts an HTTP 2 server<br/>over the downgraded connection

par For each concurrent HTTP request
    User->>+TinytunServer: HTTP request
    TinytunServer->>TinytunClient: Multiplexes HTTP request<br/>via an HTTP2 stream
    TinytunClient->>Local WEB service: HTTP request
    Local WEB service->>TinytunClient: HTTP response
    TinytunClient->>TinytunServer: HTTP response
    TinytunServer->>-User: HTTP response
end

依赖项

~13–23MB
~405K SLoC