{"id":49135196,"url":"https://github.com/therealaleph/masterhttprelayvpn-rust","last_synced_at":"2026-05-10T23:23:06.476Z","repository":{"id":352929475,"uuid":"1217102150","full_name":"therealaleph/MasterHttpRelayVPN-RUST","owner":"therealaleph","description":"Rust port of @masterking32's MasterHttpRelayVPN — all credit to @masterking32 for the original idea and Python implementation. Free DPI bypass via a Google Apps Script relay with TLS SNI concealment. CLI + cross-platform desktop UI, HTTP + SOCKS5 proxy, no runtime deps.","archived":false,"fork":false,"pushed_at":"2026-04-28T00:30:39.000Z","size":913350,"stargazers_count":857,"open_issues_count":49,"forks_count":110,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-04-28T03:14:26.555Z","etag":null,"topics":["anti-censorship","censorship-circumvention","cross-platform","desktop-app","domain-fronting","dpi-bypass","egui","google-apps-script","gui","http-proxy","iran","mitm","proxy","rust","sni","socks5","tls"],"latest_commit_sha":null,"homepage":"https://github.com/masterking32/MasterHttpRelayVPN","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/therealaleph.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-21T14:46:31.000Z","updated_at":"2026-04-28T03:01:55.000Z","dependencies_parsed_at":"2026-04-27T02:01:12.928Z","dependency_job_id":null,"html_url":"https://github.com/therealaleph/MasterHttpRelayVPN-RUST","commit_stats":null,"previous_names":["therealaleph/masterhttprelayvpn-rust"],"tags_count":82,"template":false,"template_full_name":null,"purl":"pkg:github/therealaleph/MasterHttpRelayVPN-RUST","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/therealaleph%2FMasterHttpRelayVPN-RUST","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/therealaleph%2FMasterHttpRelayVPN-RUST/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/therealaleph%2FMasterHttpRelayVPN-RUST/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/therealaleph%2FMasterHttpRelayVPN-RUST/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/therealaleph","download_url":"https://codeload.github.com/therealaleph/MasterHttpRelayVPN-RUST/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/therealaleph%2FMasterHttpRelayVPN-RUST/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32457110,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anti-censorship","censorship-circumvention","cross-platform","desktop-app","domain-fronting","dpi-bypass","egui","google-apps-script","gui","http-proxy","iran","mitm","proxy","rust","sni","socks5","tls"],"created_at":"2026-04-21T21:05:33.067Z","updated_at":"2026-04-30T07:03:37.284Z","avatar_url":"https://github.com/therealaleph.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MasterHttpRelayVPN-RUST\n\nRust port of [@masterking32's MasterHttpRelayVPN](https://github.com/masterking32/MasterHttpRelayVPN). **All credit for the original idea and the Python implementation goes to [@masterking32](https://github.com/masterking32).** This is a faithful reimplementation of the `apps_script` mode, packaged as two tiny binaries (CLI + desktop UI) with no runtime dependencies.\n\nFree DPI bypass via Google Apps Script as a remote relay, with TLS SNI concealment. Your ISP's censor sees traffic going to `www.google.com`; behind the scenes a free Google Apps Script that you deploy in your own Google account fetches the real website for you.\n\n**[English Guide](#setup-guide)** | **[راهنمای فارسی](#راهنمای-فارسی)**\n\n## Why this exists\n\nThe original Python project is excellent but requires Python + `pip install cryptography h2` + system deps. For users in hostile networks that install process is often itself broken (blocked PyPI, missing wheels, Windows without Python). This port is a single ~2.5 MB executable that you download and run. Nothing else.\n\n## How it works\n\n```\nBrowser / Telegram / xray\n        |\n        | HTTP proxy (8085)  or  SOCKS5 (8086)\n        v\nmhrv-rs (local)\n        |\n        | TLS to Google IP, SNI = www.google.com\n        v                       ^\n   DPI sees www.google.com      |\n        |                       | Host: script.google.com (inside TLS)\n        v                       |\n  Google edge frontend ---------+\n        |\n        v\n  Apps Script relay (your free Google account)\n        |\n        v\n  Real destination\n```\n\nThe censor's DPI sees `www.google.com` in the TLS SNI and lets it through. Google's frontend hosts both `www.google.com` and `script.google.com` on the same IP and routes by the HTTP `Host` header inside the encrypted stream.\n\nFor a handful of Google-owned domains (`google.com`, `youtube.com`, `fonts.googleapis.com`, …) the same tunnel is used directly instead of going through the Apps Script relay. This bypasses the per-fetch quota and fixes the \"User-Agent is always `Google-Apps-Script`\" problem for those domains. You can add more domains via the `hosts` map in config.\n\n## Platforms\n\nLinux (x86_64, aarch64), macOS (x86_64, aarch64), Windows (x86_64). Prebuilt binaries on the [releases page](https://github.com/therealaleph/MasterHttpRelayVPN-RUST/releases).\n\n## What's in a release\n\nEach archive contains two binaries and a launcher script:\n\n| file | purpose |\n|---|---|\n| `mhrv-rs` / `mhrv-rs.exe` | CLI. Headless use, servers, automation. Works on all platforms; no system deps on macOS/Windows. |\n| `mhrv-rs-ui` / `mhrv-rs-ui.exe` | Desktop UI (egui). Config form, Start/Stop/Test buttons, live stats, log panel. |\n| `run.sh` / `run.command` / `run.bat` | Platform launcher: installs the MITM CA (needs sudo/admin) and then starts the UI. Use this on first run. |\n\nmacOS archives also ship `mhrv-rs.app` (in `*-app.zip`) — double-click to launch the UI without a terminal. You'll still need to run the CLI (`mhrv-rs --install-cert`) or `run.command` once to install the CA.\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"docs/ui-screenshot.png\" alt=\"mhrv-rs desktop UI showing config form, live traffic stats, Start/Stop/Test buttons, and log panel\" width=\"420\"\u003e\u003c/p\u003e\n\nLinux UI also needs common desktop libraries available: `libxkbcommon`, `libwayland-client`, `libxcb`, `libgl`, `libx11`, `libgtk-3`. On most desktop distros these are already present; on a headless box install them via your package manager, or just use the CLI.\n\n## Where things live\n\nConfig and the MITM CA live in the OS user-data dir:\n\n- macOS: `~/Library/Application Support/mhrv-rs/`\n- Linux: `~/.config/mhrv-rs/`\n- Windows: `%APPDATA%\\mhrv-rs\\`\n\nInside that dir:\n\n- `config.json` — your settings (written by the UI's **Save** button or hand-edited)\n- `ca/ca.crt`, `ca/ca.key` — the MITM root certificate. Only you have the private key.\n\nThe CLI also falls back to `./config.json` in the current directory for backward compatibility with older setups.\n\n## Setup Guide\n\n### Step 1 — Deploy the Apps Script relay (one-time)\n\nThis part is unchanged from the original project. Follow @masterking32's guide or the summary below:\n\n1. Open \u003chttps://script.google.com\u003e while signed into your Google account.\n2. **New project**, delete the default code.\n3. Copy the contents of [`Code.gs` from the original repo](https://github.com/masterking32/MasterHttpRelayVPN/blob/python_testing/Code.gs) ([raw](https://raw.githubusercontent.com/masterking32/MasterHttpRelayVPN/refs/heads/python_testing/Code.gs)) into the editor.\n4. Change `const AUTH_KEY = \"...\"` to a strong secret only you know.\n5. **Deploy → New deployment → Web app**.\n   - Execute as: **Me**\n   - Who has access: **Anyone**\n6. Copy the **Deployment ID** (the long random string in the URL).\n\n### Step 2 — Download\n\nGrab the archive for your platform from the [releases page](https://github.com/therealaleph/MasterHttpRelayVPN-RUST/releases) and extract it.\n\nOr build from source:\n\n```bash\ncargo build --release --features ui\n# Binaries: target/release/mhrv-rs and target/release/mhrv-rs-ui\n```\n\n### Step 3 — First run: install the MITM CA\n\nTo route your browser's HTTPS traffic through the Apps Script relay, `mhrv-rs` has to terminate TLS locally on your machine, forward the request through the relay, and re-encrypt the response with a certificate your browser trusts. That requires a small **local** Certificate Authority.\n\n**What actually happens on first run:**\n\n- A fresh CA keypair (`ca/ca.crt` + `ca/ca.key`) is generated **on your machine**, in your user-data dir.\n- The public `ca.crt` is added to your system trust store so browsers accept the per-site certificates `mhrv-rs` mints on the fly. This is the step that needs sudo / Administrator.\n- The private `ca.key` **never leaves your machine**. Nothing uploads it, nothing phones home, and no remote party — including the Apps Script relay — can use it to impersonate sites to you.\n- You can revoke it at any time by deleting the CA from your OS keychain (macOS: Keychain Access → System → delete `mhrv-rs`) / Windows cert store / `/etc/ca-certificates`, and removing the `ca/` folder.\n\nThe launcher does all of this for you and then starts the UI:\n\n| platform | how |\n|---|---|\n| macOS | double-click `run.command` in Finder (or `./run.command` in a terminal) |\n| Linux | `./run.sh` from a terminal |\n| Windows | double-click `run.bat` |\n\nIt will ask for your password (sudo / UAC) **only** to trust the CA. After that the launcher also starts `mhrv-rs-ui`. On later runs you don't need the launcher — the CA is already trusted, so you can open `mhrv-rs.app` / `mhrv-rs-ui.exe` / `mhrv-rs-ui` directly.\n\nIf you prefer to do the CA step by hand:\n\n```bash\n# Linux / macOS\nsudo ./mhrv-rs --install-cert\n\n# Windows (Administrator)\nmhrv-rs.exe --install-cert\n```\n\nFirefox keeps its own cert store; the installer also drops the CA into Firefox's NSS database via `certutil` (best-effort). If Firefox still complains, import `ca/ca.crt` manually via Settings → Privacy \u0026 Security → Certificates → View Certificates → Authorities → Import.\n\n### Step 4 — Configure in the UI\n\nOpen the UI and fill in the form:\n\n- **Apps Script ID** — the Deployment ID from Step 1. Comma-separate multiple IDs for round-robin rotation across several deployments (higher quota, more throughput).\n- **Auth key** — the same secret you set in `Code.gs`.\n- **Google IP** — `216.239.38.120` is a solid default. Use the **scan** button to probe for a faster one from your network.\n- **Front domain** — keep `www.google.com`.\n- **HTTP port** / **SOCKS5 port** — defaults `8085` / `8086`.\n\nHit **Save**, then **Start**. Use **Test** any time to send one request end-to-end through the relay and report the result.\n\n### Step 4 (alternative) — CLI only\n\nEverything the UI does is also available in the CLI. Copy `config.example.json` to `config.json` (either next to the binary or into the user-data dir shown above), fill it in:\n\n```json\n{\n  \"mode\": \"apps_script\",\n  \"google_ip\": \"216.239.38.120\",\n  \"front_domain\": \"www.google.com\",\n  \"script_id\": \"PASTE_YOUR_DEPLOYMENT_ID_HERE\",\n  \"auth_key\": \"same-secret-as-in-code-gs\",\n  \"listen_host\": \"127.0.0.1\",\n  \"listen_port\": 8085,\n  \"socks5_port\": 8086,\n  \"log_level\": \"info\",\n  \"verify_ssl\": true\n}\n```\n\nThen:\n\n```bash\n./mhrv-rs                   # serve (default)\n./mhrv-rs test              # one-shot end-to-end probe\n./mhrv-rs scan-ips          # rank Google frontend IPs by latency\n./mhrv-rs --install-cert    # reinstall the MITM CA\n./mhrv-rs --help\n```\n\n`script_id` can also be a JSON array: `[\"id1\", \"id2\", \"id3\"]`.\n\n### Step 5 — Point your client at the proxy\n\nThe tool listens on **two** ports. Use whichever your client supports:\n\n**HTTP proxy** (browsers, generic HTTP clients) — `127.0.0.1:8085`\n\n- **Firefox** — Settings → Network Settings → **Manual proxy**. HTTP host `127.0.0.1`, port `8085`, tick **Also use this proxy for HTTPS**.\n- **Chrome / Edge** — use the system proxy settings, or the **Proxy SwitchyOmega** extension.\n- **macOS system-wide** — System Settings → Network → Wi-Fi → Details → Proxies → enable **Web Proxy (HTTP)** and **Secure Web Proxy (HTTPS)**, both `127.0.0.1:8085`.\n- **Windows system-wide** — Settings → Network \u0026 Internet → Proxy → **Manual proxy setup**, address `127.0.0.1`, port `8085`.\n\n**SOCKS5 proxy** (Telegram, xray, app-level clients) — `127.0.0.1:8086`, no auth.\n\n- Works for HTTP, HTTPS, **and** non-HTTP protocols (Telegram's MTProto, raw TCP). The server auto-detects each connection and falls back to plain TCP passthrough when the payload isn't HTTP.\n\n## Diagnostics\n\n- **`mhrv-rs test`** — sends one request through the relay and reports success/latency. Use this first whenever something breaks — it isolates \"relay is up\" from \"client config is wrong\".\n- **`mhrv-rs scan-ips`** — parallel TLS probe of 28 known Google frontend IPs, sorted by latency. Take the winner and put it in `google_ip`. The UI has the same thing behind the **scan** button next to the Google IP field.\n- **Periodic stats** are logged every 60 s at `info` level (relay calls, cache hit rate, bytes relayed, active vs. blacklisted scripts). The UI shows them live.\n\n## What's implemented vs. not\n\nThis port focuses on the **`apps_script` mode** — the only one that reliably works against a modern censor in 2026. Implemented:\n\n- [x] Local HTTP proxy (CONNECT for HTTPS, plain forwarding for HTTP)\n- [x] Local SOCKS5 proxy with smart TLS/HTTP/raw-TCP dispatch (Telegram, xray, etc.)\n- [x] MITM with on-the-fly per-domain cert generation via `rcgen`\n- [x] CA generation + auto-install on macOS / Linux / Windows\n- [x] Firefox NSS cert install (best-effort via `certutil`)\n- [x] Apps Script JSON relay, protocol-compatible with `Code.gs`\n- [x] Connection pooling (45 s TTL, max 20 idle)\n- [x] Gzip response decoding\n- [x] Multi-script round-robin\n- [x] Auto-blacklist failing scripts on 429 / quota errors (10-minute cooldown)\n- [x] Response cache (50 MB, FIFO + TTL, `Cache-Control: max-age` aware, heuristics for static assets)\n- [x] Request coalescing: concurrent identical GETs share one upstream fetch\n- [x] SNI-rewrite tunnels (direct to Google edge, bypassing the relay) for `google.com`, `youtube.com`, `youtu.be`, `youtube-nocookie.com`, `fonts.googleapis.com`. Extra domains configurable via the `hosts` map.\n- [x] Automatic redirect handling on the relay (`/exec` → `googleusercontent.com`)\n- [x] Header filtering (strip connection-specific, brotli)\n- [x] `test` and `scan-ips` subcommands\n- [x] Script IDs masked in logs (`prefix…suffix`) so `info` logs don't leak deployment IDs\n- [x] Desktop UI (egui) — cross-platform, no bundler needed\n\nIntentionally **not** implemented (rationale included so future contributors don't spend cycles on them):\n\n- **HTTP/2 multiplexing** — the `h2` crate state machine (stream IDs, flow control, GOAWAY) has too many subtle hang cases; coalescing + 20-connection pool already gets most of the benefit for this workload.\n- **Request batching (`q:[...]` mode)** — our connection pool + tokio async already parallelizes well; batching adds ~200 lines of state management with unclear incremental gain.\n- **Range-based parallel download** — edge cases (non-Range servers, chunked mid-stream, content-encoding) are real; YouTube-style video already bypasses Apps Script via SNI-rewrite tunnel.\n- **Other modes** (`domain_fronting`, `google_fronting`, `custom_domain`) — Cloudflare killed generic domain fronting in 2024; Cloud Run needs a paid plan. Skip unless specifically requested.\n\n## Known limitations\n\nThese are inherent to the Apps Script + domain-fronting approach, not bugs in this client. The original Python version has the same issues.\n\n- **User-Agent is fixed to `Google-Apps-Script`** for anything going through the relay. `UrlFetchApp.fetch()` does not allow overriding it. Consequence: sites that detect bots (e.g., Google search, some CAPTCHA flows) serve degraded / no-JS fallback pages to relayed requests. Workaround: add the affected domain to the `hosts` map so it's routed through the SNI-rewrite tunnel with your real browser's UA instead. `google.com`, `youtube.com`, `fonts.googleapis.com` are already there by default.\n- **Video playback is slow and quota-limited** for anything that goes through the relay. YouTube HTML loads through the tunnel (fast), but chunks from `googlevideo.com` go through Apps Script. Each Apps Script consumer account has a ~2 M `UrlFetchApp` calls/day quota and a 50 MB body limit per fetch. Fine for text browsing, painful for 1080p. Rotate multiple `script_id`s for more headroom, or use a real VPN for video.\n- **Brotli is stripped** from forwarded `Accept-Encoding` headers. Apps Script can decompress gzip, but not `br`, and forwarding `br` produces garbled responses. Minor size overhead.\n- **WebSockets don't work** through the relay — it's single request/response JSON. Sites that upgrade to WS fail (ChatGPT streaming, Discord voice, etc.).\n- **HSTS-preloaded / hard-pinned sites** will reject the MITM cert. Most sites are fine because the CA is trusted; a handful aren't.\n- **Google / YouTube 2FA and sensitive logins** may trigger \"unrecognized device\" warnings because requests originate from Google's Apps Script IPs, not yours. Log in once via the tunnel (`google.com` is in the rewrite list) to avoid this.\n\n## Security posture\n\n- The MITM root stays **on your machine only**. The `ca/ca.key` private key is generated locally and never leaves the user-data dir.\n- `auth_key` between the client and the Apps Script relay is a shared secret you pick. The server-side `Code.gs` rejects requests without a matching key.\n- Traffic between your machine and Google's edge is standard TLS 1.3.\n- What Google can see: the destination URL and headers of each request (because Apps Script fetches on your behalf). This is the same trust model as any hosted proxy — if that's not acceptable, use a self-hosted VPN instead.\n\n## License\n\nMIT. See [LICENSE](LICENSE).\n\n## Credit\n\nOriginal project: \u003chttps://github.com/masterking32/MasterHttpRelayVPN\u003e by [@masterking32](https://github.com/masterking32). The idea, the Google Apps Script protocol, the proxy architecture, and the ongoing maintenance are all his. This Rust port exists purely to make client-side distribution easier.\n\n---\n\n\u003cdiv dir=\"rtl\"\u003e\n\n## راهنمای فارسی\n\nپورت Rust پروژهٔ [MasterHttpRelayVPN](https://github.com/masterking32/MasterHttpRelayVPN) از [@masterking32](https://github.com/masterking32). **تمام اعتبار ایده و پیاده‌سازی اصلی پایتون متعلق به ایشان است.** این نسخه فقط مدل `apps_script` را به‌صورت دو فایل اجرایی کوچک (CLI + رابط گرافیکی) بدون هیچ وابستگی run-time ارائه می‌دهد.\n\nعبور رایگان از DPI با استفاده از Google Apps Script به‌عنوان رله، به‌همراه مخفی‌سازی SNI در TLS. سانسور ISP فکر می‌کند ترافیک شما به سمت `www.google.com` می‌رود؛ در پشت صحنه یک Apps Script که خودتان در اکانت گوگل خودتان دیپلوی کرده‌اید سایت اصلی را برای شما واکشی می‌کند.\n\n### چرا این نسخه؟\n\nنسخهٔ اصلی پایتون عالی است، اما نیاز به Python + نصب `cryptography` و `h2` و چند وابستگی سیستمی دارد. برای کاربرانی که PyPI فیلتر است یا Python ندارند این فرآیند خودش یک دردسر است. این پورت فقط یک فایل اجرایی ~۲.۵ مگابایتی است که دانلود می‌کنید و اجرا می‌کنید. تمام.\n\n### نحوهٔ کار\n\nمرورگر/تلگرام/xray شما با این ابزار به‌عنوان HTTP proxy یا SOCKS5 proxy صحبت می‌کند. ابزار ترافیک را از طریق TLS به یک IP گوگل می‌فرستد، اما SNI را `www.google.com` می‌گذارد. داخل TLS رمزگذاری‌شده، header به‌نام `Host: script.google.com` رد می‌شود. DPI فقط `www.google.com` را می‌بیند و اجازه عبور می‌دهد. Apps Script سایت مقصد را واکشی می‌کند و پاسخ را به شما بازمی‌گرداند.\n\nبرای چند دامنهٔ متعلق به خود گوگل (`google.com`، `youtube.com`، `fonts.googleapis.com` و …) از همین تونل مستقیم استفاده می‌شود بدون عبور از Apps Script. این کار هم مشکل سهمیهٔ Apps Script را حل می‌کند و هم مشکل «User-Agent همیشه Google-Apps-Script است» را برای این دامنه‌ها از بین می‌برد. می‌توانید دامنه‌های بیشتری را از طریق `hosts` در config اضافه کنید.\n\n### پلتفرم‌ها\n\nلینوکس (x86_64، aarch64)، مک‌اواس (x86_64، aarch64)، ویندوز (x86_64). فایل‌های آماده در [صفحهٔ releases](https://github.com/therealaleph/MasterHttpRelayVPN-RUST/releases).\n\n### محتوای هر release\n\nهر آرشیو شامل دو باینری و یک اسکریپت راه‌انداز است:\n\n- `mhrv-rs` / `mhrv-rs.exe` — نسخهٔ CLI، برای سرور و استفادهٔ headless.\n- `mhrv-rs-ui` / `mhrv-rs-ui.exe` — رابط گرافیکی دسکتاپ (egui). فرم تنظیمات، دکمه‌های Start/Stop/Test، آمار زنده، لاگ.\n- `run.sh` / `run.command` / `run.bat` — اسکریپت راه‌انداز مخصوص هر سیستم‌عامل: اول CA را نصب می‌کند (نیاز به sudo/Administrator) بعد UI را اجرا می‌کند. **بار اول حتماً همین را اجرا کنید.**\n\nنسخهٔ مک آرشیو `*-app.zip` هم دارد که داخلش `mhrv-rs.app` است — با دو بار کلیک از Finder اجرا می‌شود. ولی بار اول باید CA را نصب کنید (با `mhrv-rs --install-cert` یا همان `run.command`).\n\n### مسیر فایل‌ها\n\nConfig و ریشهٔ MITM در پوشهٔ کاربر سیستم‌عامل قرار می‌گیرند:\n\n- مک: `~/Library/Application Support/mhrv-rs/`\n- لینوکس: `~/.config/mhrv-rs/`\n- ویندوز: `%APPDATA%\\mhrv-rs\\`\n\nداخل این پوشه: `config.json`، `ca/ca.crt` (گواهی عمومی) و `ca/ca.key` (کلید خصوصی — فقط روی سیستم شماست و هرگز جایی ارسال نمی‌شود).\n\n### مراحل راه‌اندازی\n\n#### ۱. دیپلوی Apps Script (یک بار)\n\nاین بخش دقیقاً همان نسخهٔ اصلی است:\n\n۱. به \u003chttps://script.google.com\u003e بروید و با اکانت گوگل وارد شوید.\n۲. **New project** بزنید و کد پیش‌فرض را پاک کنید.\n۳. محتوای [`Code.gs`](https://github.com/masterking32/MasterHttpRelayVPN/blob/python_testing/Code.gs) ([لینک raw](https://raw.githubusercontent.com/masterking32/MasterHttpRelayVPN/refs/heads/python_testing/Code.gs)) را از ریپو اصلی کپی و Paste کنید.\n۴. خط `const AUTH_KEY = \"...\"` را به یک رمز قوی و مختص خودتان تغییر دهید.\n۵. **Deploy → New deployment → Web app**\n   - Execute as: **Me**\n   - Who has access: **Anyone**\n۶. **Deployment ID** را کپی کنید (رشتهٔ تصادفی طولانی داخل URL).\n\n#### ۲. دانلود\n\nآرشیو پلتفرم خود را از [صفحهٔ releases](https://github.com/therealaleph/MasterHttpRelayVPN-RUST/releases) بگیرید و extract کنید.\n\n#### ۳. اجرای بار اول: نصب گواهی MITM\n\nبرای اینکه ترافیک HTTPS مرورگر از طریق Apps Script رد شود، `mhrv-rs` باید TLS را **روی سیستم خودتان** باز کند، درخواست را از رله بفرستد، و پاسخ را با یک گواهی که مرورگر شما trust می‌کند دوباره رمزگذاری کند. این کار یک **Certificate Authority محلی** کوچک نیاز دارد.\n\n**چه اتفاقی در اجرای بار اول می‌افتد:**\n\n- یک keypair تازهٔ CA (`ca/ca.crt` + `ca/ca.key`) **روی سیستم شما** در پوشهٔ user-data ساخته می‌شود.\n- فایل عمومی `ca.crt` به trust store سیستم اضافه می‌شود تا مرورگر گواهی‌های per-site که `mhrv-rs` on-the-fly می‌سازد را بپذیرد. همین مرحله است که sudo / Administrator می‌خواهد.\n- کلید خصوصی `ca.key` **هرگز از سیستم شما خارج نمی‌شود**. جایی آپلود نمی‌شود، با هیچ سرور راه دوری تماس گرفته نمی‌شود، و هیچ طرف دیگری — از جمله رلهٔ Apps Script — نمی‌تواند با آن خودش را جای سایت‌ها جا بزند.\n- هر وقت خواستید می‌توانید حذفش کنید: keychain مک (Keychain Access → System → `mhrv-rs` را حذف کنید) / cert store ویندوز / `/etc/ca-certificates` در لینوکس، به‌علاوهٔ پاک کردن پوشهٔ `ca/`.\n\nاسکریپت راه‌انداز همهٔ این کارها را برایتان انجام می‌دهد و بعد UI را باز می‌کند:\n\n- **مک**: روی `run.command` دو بار کلیک کنید (یا از ترمینال `./run.command`).\n- **لینوکس**: در ترمینال `./run.sh`.\n- **ویندوز**: روی `run.bat` دو بار کلیک کنید.\n\nاسکریپت **فقط** برای trust کردن CA رمز شما را می‌خواهد (sudo یا UAC). بعد از آن UI هم باز می‌شود، و در اجراهای بعدی دیگر لازم نیست از launcher استفاده کنید — مستقیماً `mhrv-rs.app` یا `mhrv-rs-ui.exe` یا `mhrv-rs-ui` را اجرا کنید.\n\nاگر ترجیح می‌دهید مرحلهٔ CA را دستی انجام دهید:\n\n```bash\n# لینوکس/مک\nsudo ./mhrv-rs --install-cert\n\n# ویندوز (به‌عنوان Administrator)\nmhrv-rs.exe --install-cert\n```\n\nFirefox cert store خودش را جدا دارد؛ installer تلاش می‌کند از طریق `certutil` گواهی را داخل NSS فایرفاکس هم بیندازد (best-effort). اگر فایرفاکس هنوز شکایت کرد، خودتان دستی `ca/ca.crt` را از Settings → Privacy \u0026 Security → Certificates → View Certificates → Authorities → Import اضافه کنید.\n\n#### ۴. تنظیمات در UI\n\nفرم را پر کنید:\n\n- **Apps Script ID** — همان Deployment ID مرحلهٔ ۱. برای استفاده از چند deployment به‌صورت round-robin، با کاما جدا کنید.\n- **Auth key** — همان رمز `AUTH_KEY` داخل `Code.gs`.\n- **Google IP** — پیش‌فرض `216.239.38.120` خوب است. دکمهٔ **scan** کنارش IPهای دیگر گوگل را از شبکهٔ شما تست می‌کند و سریع‌ترین را معرفی می‌کند.\n- **Front domain** — همان `www.google.com` را نگه دارید.\n- **HTTP port** / **SOCKS5 port** — پیش‌فرض‌ها `8085` و `8086`.\n\n**Save** بعد **Start**. دکمهٔ **Test** در هر زمان یک درخواست کامل از طریق رله می‌فرستد و نتیجه را گزارش می‌دهد.\n\n#### ۴ (جایگزین). فقط CLI\n\nهر کاری که UI می‌کند از CLI هم قابل انجام است. `config.example.json` را به `config.json` کپی و مقادیر را پر کنید، بعد:\n\n```bash\n./mhrv-rs                   # اجرای proxy\n./mhrv-rs test              # تست یک درخواست کامل\n./mhrv-rs scan-ips          # رتبه‌بندی IPهای گوگل بر اساس تأخیر\n./mhrv-rs --install-cert    # نصب مجدد CA\n./mhrv-rs --help\n```\n\n#### ۵. تنظیم proxy در کلاینت\n\nابزار روی **دو** پورت گوش می‌دهد:\n\n**HTTP proxy** (مرورگرها) — `127.0.0.1:8085`\n\n- **Firefox** — Settings → Network Settings → **Manual proxy**. HTTP برابر `127.0.0.1`، port `8085`، تیک **Also use this proxy for HTTPS**.\n- **Chrome / Edge** — از تنظیمات proxy سیستم یا افزونهٔ **Proxy SwitchyOmega** استفاده کنید.\n- **مک (system-wide)** — System Settings → Network → Wi-Fi → Details → Proxies → **Web Proxy (HTTP)** و **Secure Web Proxy (HTTPS)** را فعال کنید، هر دو `127.0.0.1:8085`.\n- **ویندوز (system-wide)** — Settings → Network \u0026 Internet → Proxy → **Manual proxy setup**، address `127.0.0.1`، port `8085`.\n\n**SOCKS5 proxy** (تلگرام، xray، کلاینت‌های app-level) — `127.0.0.1:8086`، بدون auth.\n\nبرای HTTP و HTTPS و **هم** پروتکل‌های غیر-HTTP (MTProto تلگرام، TCP خام) کار می‌کند. ابزار به‌صورت هوشمند تشخیص می‌دهد و اگر ترافیک HTTP نبود، به‌صورت plain TCP passthrough می‌فرستد.\n\n### محدودیت‌های شناخته‌شده\n\nاین‌ها محدودیت‌های ذاتی روش Apps Script + SNI هستند، نه باگ در این کلاینت. نسخهٔ اصلی پایتون هم دقیقاً همین‌ها را دارد.\n\n- **User-Agent همیشه `Google-Apps-Script` است** برای هر چیزی که از رله رد می‌شود. `UrlFetchApp.fetch()` گوگل اجازهٔ تغییر این را نمی‌دهد. نتیجه: سایت‌هایی که ربات را تشخیص می‌دهند (مثل جست‌وجوی `google.com`، بعضی CAPTCHAها) نسخهٔ سادهٔ بدون JS را نشان می‌دهند. راه‌حل: دامنهٔ موردنظر را به `hosts` در `config.json` اضافه کنید تا از تونل SNI-rewrite (با UA واقعی مرورگر) رد شود. `google.com`، `youtube.com`، `fonts.googleapis.com` از قبل در این لیست هستند.\n- **پخش ویدیو کند است و سهمیه دارد** برای چیزهایی که از رله رد می‌شوند. HTML یوتوب از تونل می‌آید (سریع)، اما chunkهای ویدیو از `googlevideo.com` از طریق Apps Script می‌آیند. هر اکانت consumer گوگل روزانه ~۲ میلیون `UrlFetchApp` call و سقف ۵۰ مگابایت روی هر fetch دارد. برای مرور متنی عالی است، برای ۱۰۸۰p دردناک. چند `script_id` بگذارید، یا برای ویدیو از VPN واقعی استفاده کنید.\n- **Brotli فیلتر می‌شود** از header ارسالی `Accept-Encoding`. Apps Script می‌تواند gzip باز کند اما brotli نه، و اگر `br` را رد کنیم پاسخ خراب می‌شود. gzip فعال است. سربار حجمی جزئی.\n- **WebSocket کار نمی‌کند** از طریق رله (تک request/response JSON است). سایت‌هایی که به WS ارتقا می‌دهند fail می‌کنند (streaming ChatGPT، voice دیسکورد و غیره).\n- **سایت‌های HSTS-preloaded / pin-شده** گواهی MITM را قبول نمی‌کنند. اکثر سایت‌ها مشکلی ندارند چون CA ما trust شده، ولی چند مورد استثنا هستند.\n- **ورود دومرحله‌ای گوگل/یوتوب** ممکن است «دستگاه ناشناس» هشدار بدهد چون درخواست از IP Apps Script می‌آید نه IP شما. یک بار با تونل (`google.com` از قبل در لیست است) لاگین کنید.\n\n### امنیت\n\n- ریشهٔ MITM **فقط روی سیستم شما می‌ماند**. کلید خصوصی `ca/ca.key` محلی ساخته می‌شود و هرگز از user-data dir خارج نمی‌شود.\n- `auth_key` بین کلاینت و Apps Script یک secret مشترک است که خودتان انتخاب می‌کنید. کد سرور (`Code.gs`) هر درخواستی را که این کلید را نداشته باشد رد می‌کند.\n- ترافیک بین سیستم شما و لبهٔ گوگل TLS 1.3 استاندارد است.\n- آنچه گوگل می‌بیند: URL و headerهای درخواست (چون Apps Script به‌جای شما fetch می‌کند). این دقیقاً همان trust model هر proxy میزبانی‌شده است — اگر قابل قبول نیست از VPN self-hosted استفاده کنید.\n\n### اعتبار\n\nپروژهٔ اصلی: \u003chttps://github.com/masterking32/MasterHttpRelayVPN\u003e توسط [@masterking32](https://github.com/masterking32). ایده، پروتکل Apps Script، معماری proxy و نگهداری همه متعلق به ایشان است. این پورت Rust فقط برای ساده‌کردن توزیع سمت کلاینت درست شده.\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftherealaleph%2Fmasterhttprelayvpn-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftherealaleph%2Fmasterhttprelayvpn-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftherealaleph%2Fmasterhttprelayvpn-rust/lists"}