github valnesfjord/tg-ws-proxy-rs 1.0.1
tg-ws-proxy-rs: 1.0.1 bugfix

latest releases: v1.6.4, v1.6.3, v1.6.2...
3 months ago

tokio::join! in both bridge loops waited for both I/O directions to complete. When Telegram closed an idle WebSocket (~60s timeout), the download half exited while the upload half blocked forever on reader.read(), leaking the connection and its FDs. These zombie connections accumulated until the 1024 FD limit was hit, causing accept() to fail with EMFILE for any new client.

Changes

  • Core fix — bridge_ws / bridge_tcp: Replace tokio::join! with tokio::spawn + tokio::select! + abort(). When either direction exits, the peer task is immediately aborted and all its I/O handles (FDs) are freed:

    let (bytes_up, bytes_down) = tokio::select! {
        result = &mut upload => {
            let up = result.unwrap_or_else(|_| 0);
            download.abort();
            let down = download.await.unwrap_or_else(|_| 0);
            (up, down)
        }
        result = &mut download => { /* symmetric */ }
    };
  • WS blacklist → cooldown: Permanent WS_BLACKLIST replaced with a 5-minute WS_REDIRECT_COOLDOWN. A single redirect response no longer permanently bypasses WebSocket for a DC for the lifetime of the process.

  • LAN IP auto-detection: When --host 0.0.0.0 is used (router deployment), the generated tg:// link now shows the machine's actual LAN IP instead of 0.0.0.0, making the link usable by all devices on the network. Added --link-ip flag for explicit override. Startup emits a warning when bound to 127.0.0.1 (link is localhost-only).

  • README: Added router deployment section documenting --host 0.0.0.0 + --link-ip usage.

Don't miss a new tg-ws-proxy-rs release

NewReleases is sending notifications on new releases.