masterhttprelayvpn-rust
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMasterHttpRelayVPN-RUST
MasterHttpRelayVPN-RUST
Skill by ara.so — Daily 2026 Skills collection.
A Rust port of MasterHttpRelayVPN that routes traffic through a Google Apps Script relay, hiding the real destination from DPI/censorship systems. The ISP sees TLS SNI ; the actual request is proxied inside the encrypted tunnel through your own Google Apps Script deployment.
www.google.com来自ara.so的技能 — 2026每日技能合集。
这是MasterHttpRelayVPN的Rust移植版本,通过Google Apps Script中继路由流量,向DPI/审查系统隐藏真实目标地址。ISP看到的TLS SNI为;实际请求会在加密隧道内通过你自行部署的Google Apps Script进行代理。
www.google.comHow it works
工作原理
Browser → HTTP(8085)/SOCKS5(8086) → mhrv-rs → TLS to Google IP (SNI: www.google.com)
→ Google edge → Apps Script relay → real destination浏览器 → HTTP(8085)/SOCKS5(8086) → mhrv-rs → 与Google IP建立TLS连接(SNI: www.google.com)
→ Google边缘节点 → Apps Script中继 → 真实目标地址Install
安装
Prebuilt binaries (recommended)
预编译二进制文件(推荐)
Download from releases page:
- Linux:
mhrv-rs-linux-x86_64.tar.gz - macOS: or
mhrv-rs-macos-aarch64.tar.gzmhrv-rs-macos-x86_64.tar.gz - Windows:
mhrv-rs-windows-x86_64.zip - Android:
mhrv-rs-android-universal-v*.apk
从发布页面下载:
- Linux:
mhrv-rs-linux-x86_64.tar.gz - macOS: 或
mhrv-rs-macos-aarch64.tar.gzmhrv-rs-macos-x86_64.tar.gz - Windows:
mhrv-rs-windows-x86_64.zip - Android:
mhrv-rs-android-universal-v*.apk
Build from source
从源码构建
bash
undefinedbash
undefinedCLI only
仅构建CLI
cargo build --release
cargo build --release
CLI + desktop UI (egui)
构建CLI+桌面UI(基于egui)
cargo build --release --features ui
cargo build --release --features ui
Binaries output to:
二进制文件输出路径:
target/release/mhrv-rs (CLI)
target/release/mhrv-rs (CLI版本)
target/release/mhrv-rs-ui (Desktop UI)
target/release/mhrv-rs-ui (桌面UI版本)
undefinedundefinedFirst Run: Install MITM CA
首次运行:安装MITM CA证书
Required for HTTPS interception. Run once with elevated privileges:
bash
undefinedHTTPS拦截功能需要此步骤。使用管理员权限运行一次:
bash
undefinedmacOS / Linux
macOS / Linux
sudo ./mhrv-rs --install-cert
sudo ./mhrv-rs --install-cert
Windows (run as Administrator)
Windows(以管理员身份运行)
mhrv-rs.exe --install-cert
mhrv-rs.exe --install-cert
Or use platform launchers (also starts the UI):
或使用平台启动器(同时启动UI):
./run.command # macOS
./run.sh # Linux
run.bat # Windows
The CA keypair is generated locally (`ca/ca.crt` + `ca/ca.key`) and never leaves your machine../run.command # macOS
./run.sh # Linux
run.bat # Windows
CA密钥对在本地生成(`ca/ca.crt` + `ca/ca.key`),绝不会离开你的设备。Configuration
配置
Config file locations
配置文件位置
- macOS:
~/Library/Application Support/mhrv-rs/config.json - Linux:
~/.config/mhrv-rs/config.json - Windows:
%APPDATA%\mhrv-rs\config.json - Fallback: (current directory)
./config.json
- macOS:
~/Library/Application Support/mhrv-rs/config.json - Linux:
~/.config/mhrv-rs/config.json - Windows:
%APPDATA%\mhrv-rs\config.json - 备选路径:(当前目录)
./config.json
Minimal config.json
config.json极简版config.json
config.jsonjson
{
"mode": "apps_script",
"script_id": "AKfycby...",
"auth_key": "$AUTH_KEY_FROM_CODE_GS",
"google_ip": "216.239.38.120",
"front_domain": "www.google.com",
"http_port": 8085,
"socks5_port": 8086
}json
{
"mode": "apps_script",
"script_id": "AKfycby...",
"auth_key": "$AUTH_KEY_FROM_CODE_GS",
"google_ip": "216.239.38.120",
"front_domain": "www.google.com",
"http_port": 8085,
"socks5_port": 8086
}Full config.json
with all options
config.json包含所有选项的完整config.json
config.jsonjson
{
"mode": "apps_script",
"script_id": "AKfycby...,AKfycbz...",
"auth_key": "$YOUR_AUTH_KEY",
"google_ip": "216.239.38.120",
"front_domain": "www.google.com",
"http_port": 8085,
"socks5_port": 8086,
"hosts": {
"example.com": "direct"
},
"upstream_socks5": null
}Key fields:
- :
mode(default) or"apps_script"(no relay, Google domains only)"google_only" - : Deployment ID from Google Apps Script. Comma-separate multiple for round-robin rotation
script_id - : Secret matching
auth_keyin yourAUTH_KEYCode.gs - : Google edge IP —
google_ipis a reliable default216.239.38.120 - : Keep as
front_domainwww.google.com - : Per-domain overrides —
hostsbypasses the relay entirely"direct" - : Forward through an external SOCKS5 (e.g.
upstream_socks5)"127.0.0.1:1080"
json
{
"mode": "apps_script",
"script_id": "AKfycby...,AKfycbz...",
"auth_key": "$YOUR_AUTH_KEY",
"google_ip": "216.239.38.120",
"front_domain": "www.google.com",
"http_port": 8085,
"socks5_port": 8086,
"hosts": {
"example.com": "direct"
},
"upstream_socks5": null
}核心字段说明:
- :
mode(默认)或"apps_script"(无中继,仅访问Google域名)"google_only" - : Google Apps Script的部署ID,多个ID用逗号分隔可实现轮询负载均衡
script_id - : 需与
auth_key中的Code.gs一致的密钥AUTH_KEY - : Google边缘节点IP —
google_ip是可靠的默认值216.239.38.120 - : 保持为
front_domain即可www.google.com - : 按域名设置路由规则 —
hosts表示完全绕过中继"direct" - : 转发至外部SOCKS5代理(例如
upstream_socks5)"127.0.0.1:1080"
Google-only mode (no Apps Script needed)
仅Google模式(无需Apps Script)
json
{
"mode": "google_only",
"google_ip": "216.239.38.120",
"front_domain": "www.google.com",
"http_port": 8085,
"socks5_port": 8086
}Use this to bootstrap — access to deploy when Google is blocked.
script.google.comCode.gsjson
{
"mode": "google_only",
"google_ip": "216.239.38.120",
"front_domain": "www.google.com",
"http_port": 8085,
"socks5_port": 8086
}当Google被屏蔽时,可使用此模式访问来部署。
script.google.comCode.gsCLI Commands
CLI命令
bash
undefinedbash
undefinedStart proxy server (reads config.json)
启动代理服务器(读取config.json)
mhrv-rs serve
mhrv-rs serve
Start with explicit config file
使用指定配置文件启动
mhrv-rs serve --config /path/to/config.json
mhrv-rs serve --config /path/to/config.json
Test end-to-end relay connectivity
测试端到端中继连通性
mhrv-rs test
mhrv-rs test
Test SNI fronting only (no config required beyond google_ip + front_domain)
仅测试SNI前置(仅需google_ip + front_domain,无需完整配置)
mhrv-rs test-sni
mhrv-rs test-sni
Scan for fastest Google IP from your network
扫描网络中最快的Google IP
mhrv-rs scan-ips
mhrv-rs scan-ips
Install MITM CA to system trust store
安装MITM CA证书到系统信任库
mhrv-rs --install-cert
mhrv-rs --install-cert
Show version
显示版本
mhrv-rs --version
mhrv-rs --version
Show help
显示帮助
mhrv-rs --help
undefinedmhrv-rs --help
undefinedDeploy the Google Apps Script Relay
部署Google Apps Script中继
- Go to https://script.google.com → New project
- Replace default code with contents of
Code.gs - Set your auth key:
javascript
const AUTH_KEY = "your-strong-secret-here"; - Deploy → New deployment → Web app
- Execute as: Me
- Who has access: Anyone
- Copy the Deployment ID (looks like )
AKfycby... - Paste it into as
config.jsonscript_id
- 访问https://script.google.com → 新建项目
- 将默认代码替换为的内容
Code.gs - 设置你的认证密钥:
javascript
const AUTH_KEY = "your-strong-secret-here"; - 部署 → 新建部署 → Web应用
- 执行方式:我
- 访问权限:任何人
- 复制部署ID(格式类似)
AKfycby... - 将其粘贴到的
config.json字段中script_id
Common Patterns
常见使用场景
Proxy browser traffic (HTTP proxy)
代理浏览器流量(HTTP代理)
Set browser proxy to (HTTP). Most browsers: Settings → Network → Manual proxy.
127.0.0.1:8085bash
undefined将浏览器代理设置为(HTTP)。大多数浏览器设置路径:设置 → 网络 → 手动配置代理。
127.0.0.1:8085bash
undefinedTest with curl through the HTTP proxy
使用curl通过HTTP代理测试
undefinedundefinedProxy via SOCKS5
通过SOCKS5代理
bash
undefinedbash
undefinedcurl via SOCKS5
使用curl通过SOCKS5代理
curl --socks5 127.0.0.1:8086 https://example.com
curl --socks5 127.0.0.1:8086 https://example.com
Use with any SOCKS5-aware application
在支持SOCKS5的应用中使用
export ALL_PROXY=socks5://127.0.0.1:8086
undefinedexport ALL_PROXY=socks5://127.0.0.1:8086
undefinedMultiple script IDs for higher quota
多脚本ID提升配额
json
{
"script_id": "AKfycby_first...,AKfycby_second...,AKfycby_third..."
}Each Google Apps Script deployment has its own quota. Round-robin rotation spreads load.
json
{
"script_id": "AKfycby_first...,AKfycby_second...,AKfycby_third..."
}每个Google Apps Script部署都有独立配额,轮询模式可分散负载。
Per-domain direct routing
按域名设置直连路由
json
{
"hosts": {
"internal.company.com": "direct",
"192.168.1.0/24": "direct"
}
}json
{
"hosts": {
"internal.company.com": "direct",
"192.168.1.0/24": "direct"
}
}Use with xray/v2ray as upstream
与xray/v2ray配合作为上游代理
json
{
"upstream_socks5": "127.0.0.1:10808"
}json
{
"upstream_socks5": "127.0.0.1:10808"
}Headless server deployment
无头服务器部署
bash
undefinedbash
undefinedRun CLI in background
后台运行CLI
nohup mhrv-rs serve > mhrv-rs.log 2>&1 &
nohup mhrv-rs serve > mhrv-rs.log 2>&1 &
Or with systemd
或使用systemd管理
cat > /etc/systemd/system/mhrv-rs.service << 'EOF'
[Unit]
Description=MasterHttpRelayVPN-RUST
After=network.target
[Service]
ExecStart=/usr/local/bin/mhrv-rs serve
Restart=on-failure
User=nobody
WorkingDirectory=/etc/mhrv-rs
[Install]
WantedBy=multi-user.target
EOF
systemctl enable --now mhrv-rs
undefinedcat > /etc/systemd/system/mhrv-rs.service << 'EOF'
[Unit]
Description=MasterHttpRelayVPN-RUST
After=network.target
[Service]
ExecStart=/usr/local/bin/mhrv-rs serve
Restart=on-failure
User=nobody
WorkingDirectory=/etc/mhrv-rs
[Install]
WantedBy=multi-user.target
EOF
systemctl enable --now mhrv-rs
undefinedDesktop UI
桌面UI
bash
undefinedbash
undefinedLaunch UI directly
直接启动UI
./mhrv-rs-ui # Linux/macOS
mhrv-rs-ui.exe # Windows
UI features:
- Config form with all settings
- **Start / Stop** proxy server
- **Test** button — sends one request through the relay end-to-end
- **Scan** button — finds fastest Google IP for your network
- Live traffic stats
- Log panel./mhrv-rs-ui # Linux/macOS
mhrv-rs-ui.exe # Windows
UI功能:
- 包含所有设置的配置表单
- **启动/停止**代理服务器
- **测试**按钮 — 通过中继发送端到端请求
- **扫描**按钮 — 为你的网络查找最快的Google IP
- 实时流量统计
- 日志面板Android
Android端使用
- Install
mhrv-rs-android-universal-v*.apk - Follow docs/android.md
- The app uses TUN via to capture all device IP traffic
tun2proxy
Android HTTPS caveat: From Android 7+, apps must opt in to trust user CAs. Chrome and Firefox work; Telegram, WhatsApp, Instagram, etc. do not. For those apps:
- Use SOCKS5 mode: point in-app proxy to
127.0.0.1:1081 - Use mode for Google services (no CA needed)
google_only - Set to an external VPS
upstream_socks5
- 安装
mhrv-rs-android-universal-v*.apk - 参考docs/android.md
- 应用通过使用TUN捕获设备所有IP流量
tun2proxy
Android HTTPS注意事项: 从Android 7开始,应用必须主动选择信任用户CA证书。Chrome和Firefox可正常使用;但Telegram、WhatsApp、Instagram等应用不行。针对这些应用:
- 使用SOCKS5模式:在应用内设置代理为
127.0.0.1:1081 - 针对Google服务使用模式(无需CA证书)
google_only - 将设置为外部VPS代理
upstream_socks5
Troubleshooting
故障排查
"Connection refused" on proxy port
代理端口出现“Connection refused”
bash
undefinedbash
undefinedCheck if mhrv-rs is running
检查mhrv-rs是否在运行
ps aux | grep mhrv-rs
ps aux | grep mhrv-rs
Check ports are listening
检查端口是否处于监听状态
ss -tlnp | grep -E '8085|8086' # Linux
netstat -an | grep -E '8085|8086' # macOS/Windows
ss -tlnp | grep -E '8085|8086' # Linux
netstat -an | grep -E '8085|8086' # macOS/Windows
Try a different port if 8085 is taken
如果8085端口被占用,尝试更换端口
Set http_port: 8181 in config.json
在config.json中设置http_port: 8181
undefinedundefinedHTTPS sites show certificate error
HTTPS网站显示证书错误
bash
undefinedbash
undefinedCA not installed — run:
未安装CA证书 — 执行:
sudo mhrv-rs --install-cert
sudo mhrv-rs --install-cert
Firefox: manually import ca/ca.crt
Firefox:手动导入ca/ca.crt
Settings → Privacy & Security → Certificates → View Certificates → Authorities → Import
设置 → 隐私与安全 → 证书 → 查看证书 → 证书颁发机构 → 导入
undefinedundefinedApps Script relay errors / quota exceeded
Apps Script中继报错/配额超限
- Add more entries (comma-separated) for rotation
script_id - Check your Apps Script execution log at https://script.google.com
- Verify in
AUTH_KEYmatchesCode.gsinauth_keyconfig.json
- 添加多个(逗号分隔)实现轮询
script_id - 在https://script.google.com查看Apps Script执行日志
- 验证中的
Code.gs与AUTH_KEY中的config.json是否一致auth_key
Find a working Google IP
查找可用的Google IP
bash
mhrv-rs scan-ipsUpdate in config with the fastest result.
google_ipbash
mhrv-rs scan-ips将中的更新为最快的结果。
config.jsongoogle_ipCan't reach script.google.com to deploy Code.gs
无法访问script.google.com部署Code.gs
Use mode temporarily:
google_onlybash
cp config.google-only.example.json config.json
mhrv-rs serve临时使用模式:
google_onlybash
cp config.google-only.example.json config.json
mhrv-rs serveSet browser proxy to 127.0.0.1:8085
将浏览器代理设置为127.0.0.1:8085
Now open script.google.com in browser and deploy Code.gs
现在在浏览器中打开script.google.com并部署Code.gs
undefinedundefinedTest SNI fronting without full config
无需完整配置即可测试SNI前置
bash
mhrv-rs test-snibash
mhrv-rs test-sniVerify relay is working end-to-end
验证中继端到端工作正常
bash
mhrv-rs testbash
mhrv-rs testOr via curl:
或使用curl测试:
curl -v -x http://127.0.0.1:8085 https://httpbin.org/ip
undefinedcurl -v -x http://127.0.0.1:8085 https://httpbin.org/ip
undefinedFile Structure
文件结构
mhrv-rs/ # binary
mhrv-rs-ui/ # desktop UI binary
config.json # your config
ca/
ca.crt # MITM root cert (public, installed to system)
ca.key # MITM root key (private, stays local)
assets/
apps_script/
Code.gs # Apps Script relay source to deploy to Googlemhrv-rs/ # CLI二进制文件
mhrv-rs-ui/ # 桌面UI二进制文件
config.json # 你的配置文件
ca/
ca.crt # MITM根证书(公钥,安装到系统)
ca.key # MITM根密钥(私钥,仅保存在本地)
assets/
apps_script/
Code.gs # 需部署到Google的Apps Script中继源码