mirror of
https://github.com/therealaleph/MasterHttpRelayVPN-RUST.git
synced 2026-05-18 07:34:36 +03:00
feat(udp): SOCKS5 UDP ASSOCIATE relay through full tunnel
Adds end-to-end UDP support: SOCKS5 client UDP ASSOCIATE → tunnel-mux
udp_open/udp_data ops → tunnel-node UDP sessions → real UDP to upstream.
QUIC/HTTP3, DNS, and STUN now traverse full mode without falling back to
TCP or leaking outside the tunnel.
Apps Script proxies the new ops opaquely through the existing batch
endpoint; CodeFull.gs only gets a doc-comment update.
Highlights:
- proxy_server.rs: SOCKS5 UDP ASSOCIATE handler with per-session task,
bounded uplink mpsc channel, adaptive empty-poll backoff (500 ms → 30 s),
source-IP validation against the control TCP peer, port-locking on
first valid datagram, and self-removal from the dispatch map on eof.
- tunnel_client.rs: UdpOpen / UdpData / close_session mux variants
alongside the existing TCP plumbing; pkts decoder helper.
- tunnel-node: UdpSessionInner with bounded VecDeque queue, drop-oldest
on overflow with queue_drops counter and warn-then-throttled logs,
last_active refreshed only on real activity (uplink send or upstream
recv — empty polls do not refresh), independent TCP/UDP drain in
handle_batch Phase 2, separate active-drain (150 ms) and retry
(250 ms) windows for UDP, idle long-poll (5 s).
- Tests: SOCKS5 UDP packet parser (IPv4/IPv6/DOMAIN round-trips,
truncation rejects, fragmented rejects), UDP queue overflow drop +
counter, regression test that batch with both UDP and TCP-data ops
still runs the TCP retry pass.
Docs: README + android.{md,fa.md} updated to reflect UDP availability
in full mode; tunnel-node/README documents the new ops.
This commit is contained in:
+2
-2
@@ -234,9 +234,9 @@ VpnService TUN ──► tun2proxy (داخل فرایند)
|
||||
|
||||
**سایتهایی که فقط بارگذاری اول را `gate` میکنند** (اکثر مشتریان `Bot Fight Mode` کلادفلر) بعد از یک حل بیمشکل کار میکنند. سایتهایی که هر درخواست `challenge` میزنند (صرافیهای رمزارز، بزرگسال، بعضی فورومها) ذاتاً با این معماری نمیشوند — برایشان از تونل دیگری استفاده کنید.
|
||||
|
||||
### UDP / QUIC (HTTP/3) رد نمیشود
|
||||
### UDP / QUIC (HTTP/3)
|
||||
|
||||
`SOCKS5 listener` فقط `CONNECT` را میفهمد، نه `UDP ASSOCIATE`. `Chrome` اول `HTTP/3` را امتحان میکند و به `HTTP/2 over TCP` برمیگردد — که از پروکسی رد میشود. اثر: اولین اتصال کمی کندتر، بقیه چیزها عادی.
|
||||
در حالت `full`، `SOCKS5 listener` دستور `UDP ASSOCIATE` را هم میفهمد و دیتاگرامهای UDP را داخل مسیر Apps Script تا `tunnel-node` میبرد؛ بعد `tunnel-node` از سمت سرور UDP واقعی به مقصد میفرستد. ISP شما همچنان فقط HTTPS به Google میبیند. در حالت `apps_script`، UDP هنوز مسیر قدیمی را دارد: `Chrome` اول `HTTP/3` را امتحان میکند و بعد به `HTTP/2 over TCP` برمیگردد.
|
||||
|
||||
### نشت IPv6
|
||||
|
||||
|
||||
+2
-2
@@ -221,9 +221,9 @@ Cloudflare's `cf_clearance` cookie is bound to the `(IP, UA, JA3)` tuple the cha
|
||||
|
||||
**Sites that only gate the first page load** (most of CF's Bot Fight Mode customers) work fine after one solve. Sites that challenge every request (crypto exchanges, adult, some forums) fundamentally can't hold a session through this architecture — use a different tunnel for those.
|
||||
|
||||
### UDP / QUIC (HTTP/3) doesn't go through
|
||||
### UDP / QUIC (HTTP/3)
|
||||
|
||||
The SOCKS5 listener only handles `CONNECT`, not `UDP ASSOCIATE`. Chrome tries HTTP/3 first and falls back to HTTP/2 over TCP, which works fine. Effect: slightly slower first connect, everything else normal.
|
||||
In `full` mode, the SOCKS5 listener handles `UDP ASSOCIATE` and tunnels UDP datagrams through Apps Script to `tunnel-node`, which then sends real UDP to the destination. Your ISP still only sees HTTPS to Google. In `apps_script` mode, UDP still falls back the old way: Chrome tries HTTP/3 first and then uses HTTP/2 over TCP.
|
||||
|
||||
### IPv6 leaks
|
||||
|
||||
|
||||
Reference in New Issue
Block a user