You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 36232f9
Browse filesBrowse the repository at this point in the historyBrowse files
Adds a new `mode: full` that tunnels ALL traffic end-to-end through Apps Script → a remote tunnel node. Browser does TLS directly with the destination. No MITM, no CA installation needed on the client device.
Ships as part of the 3-PR series: #93 (tunnel-node service + CodeFull.gs, merged) + this (Rust-side Mode::Full + batch tunnel client) + #95 (Android UI dropdown, now rolled into this PR post-rebase).
### Architecture
- Client → mhrv-rs → script.google.com (Apps Script fetch) → tunnel-node on user's VPS → real destination
- Apps Script is the transport to reach the VPS; works even when the ISP blocks direct VPS IPs
- Batch multiplexer collects data from all active sessions and ships one Apps Script request per tick
### Safety properties of this merge
- AppsScript + GoogleOnly dispatch paths are **unchanged**; Full mode is an additive branch at the top of `dispatch_tunnel`.
- `tunnel_client.rs` is a new isolated module (387 LOC).
- `tunnel_request()` is a new method on `DomainFronter`, no change to `relay()` / `relay_parallel_range()`.
- Config: additive `Mode::Full` variant + validation tests (2 new); existing validation rules untouched.
- Local build: clean compile. `cargo test --quiet`: 75 passed (73 → 75 with 2 new config tests).
### Closes
Unblocks the feature requested in #61, #69, #100, #105, #110, #111, #113, #116.
### Testing
vahidlazio has iterated on prior review feedback. End-to-end testing with a real tunnel-node deployment will follow post-merge from @Feiabyte (volunteered in #61). Post-merge CI will exercise compile + full test matrix across all targets; any regression caught there gets a fast-follow fix.
Copy file name to clipboardExpand all lines: README.md
+62-1Lines changed: 62 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -160,7 +160,7 @@ Firefox keeps its own cert store; the installer also drops the CA into Firefox's
160
160
161
161
Open the UI and fill in the form:
162
162
163
-
-**Apps Script ID** — the Deployment ID from Step 1. Comma-separate multiple IDs for round-robin rotation across several deployments (higher quota, more throughput).
163
+
-**Apps Script ID** — the Deployment ID from Step 1. Add multiple IDs (one per line in the UI, or a JSON array in `config.json`) for higher quota**and** lower latency. In `apps_script` mode, IDs are round-robined. In `full` mode, more IDs directly increase the pipeline depth (see [Full tunnel mode](#full-tunnel-mode) below).
164
164
-**Auth key** — the same secret you set in `Code.gs`.
165
165
-**Google IP** — `216.239.38.120` is a solid default. Use the **scan** button to probe for a faster one from your network.
166
166
-**Front domain** — keep `www.google.com`.
@@ -262,6 +262,46 @@ Example config fragment (both UI and JSON):
262
262
263
263
HTTP/HTTPS continues to route through the Apps Script relay (no change), and the SNI-rewrite tunnel for `google.com` / `youtube.com` / etc. keeps bypassing both — so YouTube stays as fast as before while Telegram gets a real tunnel.
264
264
265
+
## Full tunnel mode
266
+
267
+
Full tunnel mode (`"mode": "full"`) routes **all** traffic end-to-end through Apps Script and a remote [tunnel-node](tunnel-node/) — no MITM certificate needed. The trade-off is higher latency per request (every byte goes Apps Script → tunnel-node → destination), but it works for every protocol and every app without CA installation.
268
+
269
+
### How deployment IDs affect performance
270
+
271
+
Each Apps Script batch request takes ~2 seconds round-trip. In full mode, `mhrv-rs` runs a **pipelined batch multiplexer** that fires multiple batch requests concurrently without waiting for the previous one to return. The number of in-flight batches (the *pipeline depth*) scales directly with the number of deployment IDs you configure:
272
+
273
+
```
274
+
pipeline_depth = number_of_script_ids (clamped to 2..12)
| 12 | 12 |~0.17s | Maximum — diminishing returns past this |
283
+
284
+
More deployments = more concurrent batches = lower per-session latency. Each batch round-robins across your deployment IDs, so the load is spread evenly and you're less likely to hit a single deployment's quota ceiling.
285
+
286
+
**Resource guards** keep things safe:
287
+
-**50 ops max** per batch — if more sessions are active, the mux splits into multiple batches
288
+
-**4 MB payload cap** per batch — well under Apps Script's 50 MB limit
289
+
-**30 s timeout** per batch — a slow/dead target can't block other sessions forever
290
+
291
+
### Quick start
292
+
293
+
1. Deploy [`CodeFull.gs`](assets/apps_script/CodeFull.gs) to 3–12 Google accounts (same steps as `Code.gs`, but use the full-mode script that forwards to your tunnel-node)
294
+
2. Deploy the [tunnel-node](tunnel-node/) on a VPS
295
+
3. Set `"mode": "full"` in your config with all deployment IDs:
The `*-linux-musl-*` archives ship a fully static CLI that runs on OpenWRT, Alpine, and any libc-less Linux userland. Put the binary on the router and start it as a service:
@@ -569,6 +609,27 @@ Original project: <https://github.com/masterking32/MasterHttpRelayVPN> by [@mast
569
609
۴. اگر نام جدیدی میخواهید اضافه کنید، در کادر پایین نام را بنویسید و **`+ Add`** بزنید — خودکار تست میشود
570
610
۵. با **`Save config`** در پنجرهٔ اصلی ذخیره کنید
571
611
612
+
### حالت تونل کامل (Full tunnel mode)
613
+
614
+
حالت `"mode": "full"`**تمام** ترافیک را سرتاسر از طریق `Apps Script` و یک [tunnel-node](tunnel-node/) روی سرور شما عبور میدهد — **بدون نیاز به نصب گواهی `MITM`**. تنها هزینهاش تأخیر بیشتر است (هر بایت از مسیر `Apps Script → tunnel-node → مقصد` میرود)، اما برای هر پروتکل و هر برنامه بدون نصب `CA` کار میکند.
615
+
616
+
#### چرا تعداد `Deployment ID` مهم است؟
617
+
618
+
هر درخواست دستهای (`batch`) به `Apps Script` حدود ۲ ثانیه طول میکشد. در حالت `full`، برنامه یک **لولهٔ موازی** (`pipeline`) اجرا میکند که چند درخواست دستهای را همزمان میفرستد بدون اینکه منتظر پاسخ قبلی بماند. تعداد درخواستهای همزمان مستقیماً با تعداد `Deployment ID`ها رابطه دارد:
619
+
620
+
```
621
+
عمق لوله = تعداد Deployment IDها (حداقل ۲، حداکثر ۱۲)
622
+
```
623
+
624
+
| تعداد Deployment | عمق لوله | فاصلهٔ مؤثر بین دستهها ||
بیشتر `Deployment` = بیشتر درخواست همزمان = تأخیر کمتر برای هر نشست. هر دسته بین `ID`ها چرخش میکند (`round-robin`)، پس بار بهطور یکنواخت توزیع میشود.
632
+
572
633
### اجرا روی OpenWRT (روتر)
573
634
574
635
اگر میخواهید برنامه را روی روترتان اجرا کنید تا همهٔ دستگاههای شبکه از آن استفاده کنند، آرشیو `mhrv-rs-linux-musl-*.tar.gz` را دانلود کنید (این نسخه فایل اجرایی استاتیک دارد و بدون نصب هیچ وابستگی روی روتر کار میکند).
0 commit comments