Skip to content

feat: tunnel-node service + CodeFull.gs (1/3) - #93

Merged
therealaleph merged 1 commit into
therealaleph:mainfrom
vahidlazio:feat/tunnel-node
Apr 23, 2026
Merged

therealaleph merged 1 commit into
therealaleph:mainfrom
vahidlazio:feat/tunnel-node

Conversation

@vahidlazio

Copy link
Copy Markdown
Contributor

Part 1 of 3: Full Tunnel Mode

Standalone tunnel node server + Apps Script. No changes to the main Rust crate.

What

  • tunnel-node/: Rust HTTP server (axum) that bridges HTTP tunnel requests to real TCP connections. Session-based protocol: connect, data, close, batch. Docker-ready for Cloud Run or any VPS.
  • assets/apps_script/CodeFull.gs: Extends Code.gs with tunnel forwarding (single + batch) alongside existing HTTP relay.
  • config.full.example.json: Example config for full mode.

Why a separate tunnel node?

Apps Script can only make HTTP requests (UrlFetchApp.fetch()). It cannot open raw TCP sockets. The tunnel node holds persistent TCP connections and translates between HTTP (from Apps Script) and raw TCP (to destinations).

Recommended: deploy on Google Cloud Run — same Google network as Apps Script, minimal UrlFetchApp hop latency.

Deployment

cd tunnel-node
gcloud run deploy tunnel-node --source . --region us-central1 \
  --allow-unauthenticated --set-env-vars TUNNEL_AUTH_KEY=$(openssl rand -hex 24) \
  --memory 256Mi --cpu 1 --max-instances 1

See tunnel-node/README.md for Docker and direct binary options.

Files

  • tunnel-node/Cargo.toml, tunnel-node/src/main.rs, tunnel-node/Dockerfile, tunnel-node/README.md, tunnel-node/.gitignore
  • assets/apps_script/CodeFull.gs
  • config.full.example.json

🤖 Generated with Claude Code

Standalone Rust HTTP server that bridges HTTP tunnel requests to real
TCP connections. Apps Script can only make HTTP requests (UrlFetchApp),
not raw TCP — the tunnel node holds persistent TCP sockets and
translates between HTTP (from Apps Script) and raw TCP (to destinations).

- tunnel-node/: axum-based HTTP server with connect/data/close/batch
  protocol, session management, background reader per session, idle
  reaping, Docker-ready for Cloud Run or any VPS
- assets/apps_script/CodeFull.gs: extends Code.gs with tunnel
  forwarding (single + batch ops) alongside existing HTTP relay
- config.full.example.json: example config for full mode

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@therealaleph
therealaleph merged commit 4818143 into therealaleph:main Apr 23, 2026
therealaleph added a commit that referenced this pull request Apr 23, 2026
 + #93)

- Android DEFAULT_SNI_POOL: mirror the Rust-side fix from #92 —
  accounts.googl.com replaced by accounts.google.com. Same cert-SAN
  mismatch that was failing every Nth rotation in the Rust client
  affected the Android user's sniHosts population; both pools need
  to stay in sync by design.

- Release rolls up PR #92 (cert fix) and PR #93 (tunnel-node +
  CodeFull.gs scaffolding). PR #93 adds a standalone binary under
  tunnel-node/ plus an Apps Script companion; no main-crate changes,
  so this is a zero-risk merge. Users who want to deploy a tunnel
  node can start today. The dispatch that activates `mode: full` is
  still in review in PR #94.
@barzamini

Copy link
Copy Markdown

Interesting architecture using Apps Script + Cloud Run tunnel-node. Has anyone tested PR #93 tunnel-node mode in real conditions? Curious whether it provides measurable throughput/latency gains for destinations outside Google (X, Telegram, CDNs, random websites), or if the main benefit is better censorship bypass, stability, and reliability.

therealaleph pushed a commit that referenced this pull request Apr 24, 2026
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.
therealaleph pushed a commit that referenced this pull request Apr 25, 2026
Standalone Rust/axum HTTP server + Apps Script-side CodeFull.gs for users who want to deploy a remote tunnel node. All new files; no changes to the main Rust crate. This is part 1 of 3 of the full-tunnel feature — it adds scaffolding that users can opt into once the Rust-side Mode::Full lands in #94.
therealaleph added a commit that referenced this pull request Apr 25, 2026
 + #93)

- Android DEFAULT_SNI_POOL: mirror the Rust-side fix from #92 —
  accounts.googl.com replaced by accounts.google.com. Same cert-SAN
  mismatch that was failing every Nth rotation in the Rust client
  affected the Android user's sniHosts population; both pools need
  to stay in sync by design.

- Release rolls up PR #92 (cert fix) and PR #93 (tunnel-node +
  CodeFull.gs scaffolding). PR #93 adds a standalone binary under
  tunnel-node/ plus an Apps Script companion; no main-crate changes,
  so this is a zero-risk merge. Users who want to deploy a tunnel
  node can start today. The dispatch that activates `mode: full` is
  still in review in PR #94.
therealaleph pushed a commit that referenced this pull request Apr 25, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants