Repository navigation
Description
Description:
First, thank you for the excellent work on this Rust port. The core architecture of utilizing Google Apps Script (GAS) as a relay while hiding behind the www.google.com SNI is a brilliant approach to bypassing DPI.
However, given the inherent constraints of GAS (such as baseline RTT latency and HTTP protocol limitations), I believe the project could benefit from advanced mechanisms similar to what Xray-core has achieved with xhttp. I would like to propose a few architectural enhancements focused on reducing latency/jitter, masking traffic entropy, and fortifying the server against active probing by the GFW.
- Payload Entropy and Cryptographic Enhancements
Currently, the TLS fingerprint is masked by Google's infrastructure, which is great. But DPI systems also heavily rely on Traffic Analysis (timing and payload length). To prevent the DPI from identifying the tunneled data inside the HTTPS payloads:
Traffic Shaping & Random Padding: Introduce randomized padding to the payloads sent to the GAS relay. This ensures the packet sizes are completely randomized, mimicking standard, variable-sized API requests to Google rather than fixed-pattern VPN traffic.
Hardware-Accelerated Cryptography: For the inner layer encryption, implementing AES-128-GCM leveraging hardware acceleration (AES-NI) would provide the best balance between speed and security, reducing overhead on the client side.
Post-Quantum Forward Secrecy (Optional/Future): For the initial handshake between the Rust client and the tunnel-node (in full mode), utilizing a lightweight KEM like Kyber-512 would secure the symmetric key exchange against store-and-decrypt attacks.
- Speed, Ping, and Jitter Optimization
GAS introduces high latency and is susceptible to packet loss in restrictive networks.
Aggressive Multiplexing (xmux over standard mux): Instead of opening single HTTP connections or using standard multiplexing, implementing an aggressive multiplexing strategy like xmux is highly recommended. Splitting streams and aggressively multiplexing them across multiple GAS workers provides significantly better stability and handles packet loss in hostile network environments much more effectively.
Round-Robin Aggregation: When scaling across multiple Google accounts, aggregating the deployment IDs into a robust round-robin pool will help evenly distribute the concurrent request limits and keep the multiplexer fed, effectively hiding the baseline GAS latency through proactive fetching.
- Server-Level Active Probing Defense
Defending against active probing must be handled directly at the server level by identifying and neutralizing unauthorized requests, rather than relying on client-side routing adjustments.
GAS Relay Level: If the GFW actively probes the Web App URL with malformed requests or missing/invalid AUTH_KEYs, the script should never return standard HTTP error codes (like 403 Forbidden or 500 Internal Server Error). Instead, it should return a decoy 200 OK response (e.g., rendering a fake Google search or benign HTML) to trick the scanner into categorizing the endpoint as a normal webpage.
Tunnel-Node Level (Stealth Drop): For the backend tunnel-node, relying strictly on AEAD authentication tags is crucial. If the server receives a packet where the AEAD tag fails to authenticate, it should perform a Silent Drop. Sending no response back whatsoever makes the node entirely invisible to active scanners looking for a proxy handshake.
I would love to hear your thoughts on integrating these concepts into the roadmap. Thanks again for maintaining this project!
Activity
therealaleph commentedon Apr 27, 2026
@w0l4i — substantive proposal, working through each section. Ranking by impact-to-mhrv-rs vs implementation complexity:
1. Payload Entropy and Cryptographic Enhancements
Random padding — agreed, high value, ship-able as small change
This is the single highest-leverage item in your proposal for mhrv-rs's specific situation (Iran ISP RST-injection per #313). The current per-batch payload size is fairly stable (single-op vs multi-op give ~10x size variance, but within each category it's tight). DPI fingerprinting on packet length distributions is a known vector.
Implementation: in
src/domain_fronter.rs::relay(), append a random-length blob (0-512 bytes) to the JSON request body inside a"_pad"field. Server-side ignores it. ~20 LOC client + 1 LOC server. Net cost: ~10% bandwidth increase (acceptable), strong improvement against length-based fingerprinting.v1.8.x candidate, will ship.
AES-128-GCM with AES-NI — already covered, transparent to us
mhrv-rs uses
tokio-rustlswith theringcrypto backend.ringalready uses AES-NI when present (x86_64 with AESNI capability detection at runtime).aws-lc-rs(rustls's other backend) does the same. We're not implementing crypto by hand; the right primitive is already wired.No-op for us. The performance is already there.
Post-quantum KEM (Kyber-512) — decline for now
Kyber-512 (or its standardized name ML-KEM-512) is good crypto. But:
ml-kemcrate orpqcryptoare options but neither is rock-solid)Defer to v2.x or later. When
rustlsships hybrid PQ KEMs and theringbackend supports them, we get it for free.2. Speed, Ping, and Jitter Optimization
Aggressive multiplexing (xmux-style) — partially exists, more available
Current state in mhrv-rs's
tunnel_client::mux_loop:BATCH_COALESCE_WINDOWfor op coalescingWhat we don't do:
Stream splitting is genuinely hard given Apps Script's single-shot semantics — would need an ordering+reassembly layer at the tunnel-node and a duplicate-suppression/late-write layer on the response side. Probably ~500 LOC + non-trivial test infrastructure (need to model out-of-order packet arrival).
Tracking as v1.9.x candidate. xmux-style stream splitting is real architectural work, not a quick add.
Proactive prefetching is simpler — we could speculatively fire a "drain my outbound queue" batch every 200ms even when the client has no immediate request. But that bumps quota use by a lot for users who aren't actively browsing. Trade-off worth measuring.
Round-robin aggregation — already exists
src/domain_fronter.rs::next_script_id()does this. ✅3. Server-Level Active Probing Defense
GAS decoy 200 OK on bad AUTH_KEY — good idea, ship-able
Current behavior in
Code.gs: bad AUTH_KEY → returns{"e":"unauthorized"}with HTTP 200 (Apps Script'sContentServicealways returns 200 — the error is in JSON body). This is already partially correct — we don't return 403/500. But we do return a recognizable JSON shape.Improvement: detect probe-shaped requests (no AUTH_KEY, malformed body, bad path) and return a decoy HTML page that looks like a Google search result or login page.
~20 LOC change in Code.gs.Concern: Apps Script's gateway already responds with the project owner's chosen response for any
doGet/doPost. If we return decoy HTML, every legitimate but-broken client (e.g. user with bad config) gets fed HTML and is harder to debug. We'd need a "diagnostic mode" config flag for development that returns the real error.v1.8.x candidate, contingent on figuring out the diagnostic mode UX. Worth doing.
Tunnel-node silent drop on AEAD fail — agreed, ship-able
Current behavior in
tunnel-node: bad auth → returns HTTP 401. Trivially probeable.Fix: silent drop. ~5 LOC change in the request handler.
Concern: debugging a misconfigured tunnel-node becomes harder. Solution: a
MHRV_DIAGNOSTIC_MODE=1env var that re-enables verbose error responses for setup. Default to silent in production.v1.8.x candidate, definitely ship.
Summary
Three concrete v1.8.x items to add to the roadmap:
domain_fronter::relay()These are all well-bounded — no architectural rewrite, no external dep changes, ~50-100 LOC total. Could ship in a v1.8.x point release within 2-3 weeks.
If you want to take the random-padding piece as a PR, that's the simplest and highest-leverage. Pattern follows the existing JSON request body construction in
relay().Thanks for the thoughtful proposal. The Xray-core comparison is apt — we're solving the same problem with a different transport, and lessons there transfer directly.
[reply via Anthropic Claude | reviewed by @therealaleph]
w0l4i commentedon Apr 27, 2026
@therealaleph — Great to see the v1.8 roadmap taking shape. Shipping Random Padding and Silent Drop will immediately raise the bar against basic detection. Regarding the deferred items, I'd like to provide some technical context on why xmux-style stream splitting and advanced entropy are worth the "architectural heavy lifting" sooner rather than later.
While adding a _pad field is a great v1.8 win, advanced DPI doesn't just look at single packets; it looks at the Probability Density Function (PDF) of packet lengths and inter-arrival times.
The Proposal: Instead of just appending 0-512 bytes, we should aim for Dynamic Padding that morphs the packet size distribution to match a specific "Target Profile" (like standard Google Workspace traffic).
Jittering the Window: I suggest adding a "Jitter" factor to the BATCH_COALESCE_WINDOW. If the window is always exactly 8ms, it becomes a temporal fingerprint. Making it 8ms ± 20% randomized would break the timing signature.
You mentioned that stream splitting is a ~500 LOC task with reassembly complexity. Here is why it's the "Ultimate Shield":
Survivability vs. Throttling: In many hostile networks (like Iran's latest ISP behaviors), GFW doesn't just block; it throttles specific flows or injects RSTs into long-lived Google Edge connections that exhibit consistent "proxy-like" throughput.
The xmux Advantage: In the current "One stream = One deployment" model, if that specific Deployment ID or its underlying worker gets throttled, the user's TCP stream dies or lags. With True xmux (Stream Splitting), pieces of a single 4K video stream or a large file download are scattered across 5-10 different Google accounts. Even if 2 accounts are throttled, the reassembly layer ensures the session stays alive.
Implementation Thought: To simplify the "500 LOC" hurdle, we could start with a "Light xmux"—only splitting large outbound/inbound buffers (above a certain MTU-like threshold) while keeping small metadata packets on a primary lane.
Regarding the quota concern for proactive pre-fetching:
Instead of a constant 200ms fire, we can use a "Burst-Aware" pre-fetch. If the client has seen activity in the last 2 seconds, it maintains a "hot" state with speculative batches. If idle, it goes "cold" to save quota. This keeps the UX snappy (lowering perceived RTT) during active browsing without wasting the 30-concurrent-request limit during idle times.
Summary
The jump from v1.8 (Fingerprinting fix) to v1.9 (Architectural robustness) is where this project can truly surpass standard VPN protocols. If we can evolve the Batch Mux into a Distributed Mux (xmux), we create a transport that is nearly impossible to kill without blocking Google's entire CIDR range.
I'm happy to help with more detailed logic for the reassembly layer or testing out-of-order arrival scenarios if you decide to move xmux up the roadmap!
feat: v1.8.0 — DPI evasion, active-probing defense, full-mode usage c…