fix(tunnel): start client read immediately, await socket.opened

Two bugs causing "Connecting..." hang:

1. tunnel.go: streamReadLoop was deferred until CONNECT_OK arrived,
   but client already sends TLS ClientHello before that. Data was
   lost → DC never responded → timeout. Fix: start readLoop
   immediately after sending CONNECT frame.

2. worker.js: connect() was called but socket.opened was not awaited
   before sending CONNECT_OK. Fix: await socket.opened, and fix
   Uint8Array buffer slicing for DATA relay.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Necronicle 2026-04-11 00:52:23 +03:00
parent a00f6307fc
commit 109140124a
3 changed files with 13 additions and 5 deletions