masterhttprelayvpn-proxy

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

MasterHttpRelayVPN Proxy

MasterHttpRelayVPN 代理

Skill by ara.so — Daily 2026 Skills collection.
MasterHttpRelayVPN is a domain-fronted HTTP/SOCKS5 proxy that tunnels traffic through Google Apps Script. It disguises requests as Google traffic to evade DPI/firewalls, performs local MITM TLS interception to re-encrypt traffic, and requires only a free Google account — no VPS needed.
Traffic flow:
Browser → Local Proxy (127.0.0.1:8085) → Google IP (front_domain) → Apps Script Relay → Target Website

ara.so提供的技能——2026每日技能合集。
MasterHttpRelayVPN是一款基于域名前置的HTTP/SOCKS5代理,通过Google Apps Script实现流量隧道传输。它将请求伪装成Google流量以规避DPI/防火墙,执行本地MITM TLS拦截并重新加密流量,仅需免费Google账户即可使用——无需VPS。
流量流向:
浏览器 → 本地代理(127.0.0.1:8085) → Google IP(front_domain) → Apps Script中继 → 目标网站

Installation

安装

bash
git clone https://github.com/masterking32/MasterHttpRelayVPN.git
cd MasterHttpRelayVPN
pip install -r requirements.txt
Behind a firewall (PyPI mirror):
bash
pip install -r requirements.txt -i https://mirror-pypi.runflare.com/simple/ --trusted-host mirror-pypi.runflare.com
Quick start scripts (handles venv + deps automatically):
bash
undefined
bash
git clone https://github.com/masterking32/MasterHttpRelayVPN.git
cd MasterHttpRelayVPN
pip install -r requirements.txt
防火墙环境下使用(PyPI镜像):
bash
pip install -r requirements.txt -i https://mirror-pypi.runflare.com/simple/ --trusted-host mirror-pypi.runflare.com
快速启动脚本(自动处理虚拟环境和依赖):
bash
undefined

Linux/macOS

Linux/macOS

chmod +x start.sh && ./start.sh
chmod +x start.sh && ./start.sh

Windows

Windows

start.bat

---
start.bat

---

Step 1: Deploy the Google Apps Script Relay

步骤1:部署Google Apps Script中继

  1. Go to https://script.google.com/ and create a New project
  2. Delete default code, paste the contents of
    apps_script/Code.gs
  3. Set a strong password on this line:
    javascript
    const AUTH_KEY = "your-secret-password-here";
  4. Click Deploy → New deployment → Web app
    • Execute as: Me
    • Who has access: Anyone
  5. Copy the Deployment ID (long random string)

  1. 访问https://script.google.com/并创建一个新项目
  2. 删除默认代码,粘贴
    apps_script/Code.gs
    中的内容
  3. 在以下行设置强密码:
    javascript
    const AUTH_KEY = "your-secret-password-here";
  4. 点击部署 → 新建部署 → 网页应用
    • 执行方式:
    • 访问权限:任何人
  5. 复制部署ID(长随机字符串)

Step 2: Configure

步骤2:配置

Option A — Interactive wizard (recommended)

选项A — 交互式向导(推荐)

bash
python setup.py
Prompts for Deployment ID, generates a random
auth_key
, writes
config.json
.
bash
python setup.py
提示输入部署ID,生成随机
auth_key
,并写入
config.json

Option B — Manual config

选项B — 手动配置

bash
cp config.example.json config.json
Edit
config.json
:
json
{
  "mode": "apps_script",
  "google_ip": "216.239.38.120",
  "front_domain": "www.google.com",
  "script_id": "AKfycb...",
  "auth_key": "your-secret-password-here",
  "listen_host": "127.0.0.1",
  "listen_port": 8085,
  "socks5_enabled": true,
  "socks5_port": 1080,
  "log_level": "INFO",
  "verify_ssl": true
}
auth_key
in
config.json
must match
AUTH_KEY
in
Code.gs
.

bash
cp config.example.json config.json
编辑
config.json
json
{
  "mode": "apps_script",
  "google_ip": "216.239.38.120",
  "front_domain": "www.google.com",
  "script_id": "AKfycb...",
  "auth_key": "your-secret-password-here",
  "listen_host": "127.0.0.1",
  "listen_port": 8085,
  "socks5_enabled": true,
  "socks5_port": 1080,
  "log_level": "INFO",
  "verify_ssl": true
}
config.json
中的
auth_key
必须与
Code.gs
中的
AUTH_KEY
一致。

Step 3: Run

步骤3:运行

bash
python3 main.py
Install CA certificate (run once, or re-run anytime):
bash
python main.py --install-cert

bash
python3 main.py
安装CA证书(运行一次即可,也可随时重新运行):
bash
python main.py --install-cert

Configuration Reference

配置参考

Main Settings

主要设置

KeyDescription
mode
Always
"apps_script"
script_id
Google Apps Script Deployment ID
auth_key
Shared secret between proxy and relay
listen_host
"127.0.0.1"
(local only) or
"0.0.0.0"
(LAN)
listen_port
HTTP proxy port (default:
8085
)
socks5_enabled
Enable SOCKS5 listener
socks5_port
SOCKS5 port (default:
1080
)
log_level
DEBUG
,
INFO
,
WARNING
,
ERROR
配置项说明
mode
固定为
"apps_script"
script_id
Google Apps Script部署ID
auth_key
代理与中继之间的共享密钥
listen_host
"127.0.0.1"
(仅本地访问)或
"0.0.0.0"
(局域网访问)
listen_port
HTTP代理端口(默认:
8085
socks5_enabled
是否启用SOCKS5监听器
socks5_port
SOCKS5端口(默认:
1080
log_level
DEBUG
,
INFO
,
WARNING
,
ERROR

Advanced Settings

高级设置

KeyDefaultDescription
google_ip
"216.239.38.120"
Google IP to connect through
front_domain
"www.google.com"
Domain shown to firewall
verify_ssl
true
Verify upstream TLS certs
script_ids
[]
Multiple deployment IDs for load balancing
lan_sharing
false
Allow LAN devices to use proxy
block_hosts
[]
Hosts that return HTTP 403 (e.g.
".doubleclick.net"
)
bypass_hosts
["localhost", ".local", ".lan", ".home.arpa"]
Hosts that go direct (no MITM/relay)
配置项默认值说明
google_ip
"216.239.38.120"
用于连接的Google IP地址
front_domain
"www.google.com"
向防火墙展示的域名
verify_ssl
true
是否验证上游TLS证书
script_ids
[]
用于负载均衡的多个部署ID
lan_sharing
false
是否允许局域网设备使用代理
block_hosts
[]
返回HTTP 403的主机(例如
".doubleclick.net"
bypass_hosts
["localhost", ".local", ".lan", ".home.arpa"]
直接访问的主机(无需MITM/中继)

Full config example with all advanced options

包含所有高级选项的完整配置示例

json
{
  "mode": "apps_script",
  "google_ip": "216.239.38.120",
  "front_domain": "www.google.com",
  "script_ids": [
    "AKfycbDEPLOYMENT_ID_1",
    "AKfycbDEPLOYMENT_ID_2"
  ],
  "auth_key": "super-strong-random-password",
  "listen_host": "0.0.0.0",
  "listen_port": 8085,
  "socks5_enabled": true,
  "socks5_port": 1080,
  "lan_sharing": true,
  "log_level": "INFO",
  "verify_ssl": true,
  "block_hosts": [
    ".doubleclick.net",
    "ads.example.com"
  ],
  "bypass_hosts": [
    "localhost",
    ".local",
    ".lan",
    "192.168.1.1"
  ]
}

json
{
  "mode": "apps_script",
  "google_ip": "216.239.38.120",
  "front_domain": "www.google.com",
  "script_ids": [
    "AKfycbDEPLOYMENT_ID_1",
    "AKfycbDEPLOYMENT_ID_2"
  ],
  "auth_key": "super-strong-random-password",
  "listen_host": "0.0.0.0",
  "listen_port": 8085,
  "socks5_enabled": true,
  "socks5_port": 1080,
  "lan_sharing": true,
  "log_level": "INFO",
  "verify_ssl": true,
  "block_hosts": [
    ".doubleclick.net",
    "ads.example.com"
  ],
  "bypass_hosts": [
    "localhost",
    ".local",
    ".lan",
    "192.168.1.1"
  ]
}

CA Certificate Installation (Required for HTTPS)

CA证书安装(HTTPS必需)

The proxy performs MITM TLS interception. A local CA is generated at
ca/ca.crt
on first run. Install it once per machine/browser.
该代理执行MITM TLS拦截。首次运行时会在
ca/ca.crt
生成本地CA证书。每台机器/浏览器需安装一次。

Linux (Ubuntu/Debian)

Linux(Ubuntu/Debian)

bash
sudo cp ca/ca.crt /usr/local/share/ca-certificates/masterhttp-relay.crt
sudo update-ca-certificates
bash
sudo cp ca/ca.crt /usr/local/share/ca-certificates/masterhttp-relay.crt
sudo update-ca-certificates

macOS

macOS

bash
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ca/ca.crt
bash
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ca/ca.crt

Windows (PowerShell as Admin)

Windows(以管理员身份运行PowerShell)

powershell
certutil -addstore -f "ROOT" ca\ca.crt
powershell
certutil -addstore -f "ROOT" ca\ca.crt

Firefox (all platforms)

Firefox(全平台)

Settings → Privacy & Security → Certificates → View Certificates → Authorities → Import → select
ca/ca.crt
→ check "Trust this CA to identify websites"
⚠️ Never share the
ca/
folder. Delete it to regenerate a fresh CA.

设置 → 隐私与安全 → 证书 → 查看证书 → 证书颁发机构 → 导入 → 选择
ca/ca.crt
→ 勾选"信任此CA以识别网站"
⚠️ 切勿共享
ca/
文件夹。删除该文件夹可重新生成新的CA证书。

Browser Proxy Configuration

浏览器代理配置

HTTP Proxy:
127.0.0.1:8085

SOCKS5 Proxy:
127.0.0.1:1080
HTTP代理:
127.0.0.1:8085

SOCKS5代理:
127.0.0.1:1080

Firefox

Firefox

Settings → General → Network Settings → Manual proxy configuration:
  • HTTP Proxy:
    127.0.0.1
    , Port:
    8085
  • Check: "Also use this proxy for HTTPS"
设置 → 常规 → 网络设置 → 手动配置代理:
  • HTTP代理:
    127.0.0.1
    ,端口:
    8085
  • 勾选:"此代理也用于HTTPS"

Chrome/Edge (Windows system proxy)

Chrome/Edge(Windows系统代理)

Settings → Network → Proxy → Manual proxy setup →
127.0.0.1:8085
设置 → 网络和Internet → 代理 → 手动设置代理 →
127.0.0.1:8085

Using curl for testing

使用curl测试

bash
curl -x http://127.0.0.1:8085 https://example.com
bash
curl -x http://127.0.0.1:8085 https://example.com

or SOCKS5

或使用SOCKS5

curl --socks5 127.0.0.1:1080 https://example.com
undefined
curl --socks5 127.0.0.1:1080 https://example.com
undefined

Using requests in Python

在Python中使用requests库

python
import requests

proxies = {
    "http": "http://127.0.0.1:8085",
    "https": "http://127.0.0.1:8085",
}
response = requests.get("https://example.com", proxies=proxies)
print(response.status_code)

python
import requests

proxies = {
    "http": "http://127.0.0.1:8085",
    "https": "http://127.0.0.1:8085",
}
response = requests.get("https://example.com", proxies=proxies)
print(response.status_code)

LAN Sharing Setup

局域网共享设置

Allow other devices on your network to use the proxy:
json
{
  "lan_sharing": true,
  "listen_host": "0.0.0.0",
  "listen_port": 8085
}
On startup, the proxy logs your LAN IP addresses. Configure other devices to use
<YOUR_LAN_IP>:8085
.

允许网络中的其他设备使用代理:
json
{
  "lan_sharing": true,
  "listen_host": "0.0.0.0",
  "listen_port": 8085
}
启动时,代理会记录你的局域网IP地址。将其他设备配置为使用
<你的局域网IP>:8085

Load Balancing with Multiple Relays

多中继负载均衡

Deploy multiple Google Apps Script projects and list all Deployment IDs:
json
{
  "script_ids": [
    "AKfycbFIRST_DEPLOYMENT_ID",
    "AKfycbSECOND_DEPLOYMENT_ID",
    "AKfycbTHIRD_DEPLOYMENT_ID"
  ],
  "auth_key": "same-password-in-all-scripts"
}
All Apps Script deployments must have the same
AUTH_KEY
value.

部署多个Google Apps Script项目并列出所有部署ID:
json
{
  "script_ids": [
    "AKfycbFIRST_DEPLOYMENT_ID",
    "AKfycbSECOND_DEPLOYMENT_ID",
    "AKfycbTHIRD_DEPLOYMENT_ID"
  ],
  "auth_key": "所有脚本使用相同密码"
}
所有Apps Script部署必须使用相同的
AUTH_KEY
值。

Common Patterns

常见配置模式

Blocking ads/trackers

拦截广告/追踪器

json
{
  "block_hosts": [
    ".doubleclick.net",
    ".googlesyndication.com",
    ".googleadservices.com",
    "ads.example.com"
  ]
}
json
{
  "block_hosts": [
    ".doubleclick.net",
    ".googlesyndication.com",
    ".googleadservices.com",
    "ads.example.com"
  ]
}

Bypassing local/LAN resources (no MITM)

绕过本地/局域网资源(无需MITM)

json
{
  "bypass_hosts": [
    "localhost",
    "127.0.0.1",
    ".local",
    ".lan",
    ".home.arpa",
    "192.168.1.0/24"
  ]
}
json
{
  "bypass_hosts": [
    "localhost",
    "127.0.0.1",
    ".local",
    ".lan",
    ".home.arpa",
    "192.168.1.0/24"
  ]
}

Running with debug logging

启用调试日志运行

bash
undefined
bash
undefined

In config.json

在config.json中设置

{ "log_level": "DEBUG" }
{ "log_level": "DEBUG" }

Or temporarily

或临时启用

python3 main.py
undefined
python3 main.py
undefined

Scripted config generation

脚本化生成配置

python
import json
import secrets

config = {
    "mode": "apps_script",
    "google_ip": "216.239.38.120",
    "front_domain": "www.google.com",
    "script_id": "PASTE_DEPLOYMENT_ID_HERE",
    "auth_key": secrets.token_urlsafe(32),
    "listen_host": "127.0.0.1",
    "listen_port": 8085,
    "socks5_enabled": True,
    "socks5_port": 1080,
    "log_level": "INFO",
    "verify_ssl": True
}

with open("config.json", "w") as f:
    json.dump(config, f, indent=2)

print(f"Generated auth_key: {config['auth_key']}")
print("Remember to set this same value as AUTH_KEY in Code.gs")

python
import json
import secrets

config = {
    "mode": "apps_script",
    "google_ip": "216.239.38.120",
    "front_domain": "www.google.com",
    "script_id": "粘贴部署ID到此处",
    "auth_key": secrets.token_urlsafe(32),
    "listen_host": "127.0.0.1",
    "listen_port": 8085,
    "socks5_enabled": True,
    "socks5_port": 1080,
    "log_level": "INFO",
    "verify_ssl": True
}

with open("config.json", "w") as f:
    json.dump(config, f, indent=2)

print(f"生成的auth_key: {config['auth_key']}")
print("请记得在Code.gs中设置相同的AUTH_KEY值")

Troubleshooting

故障排除

"Security warning" on every website

每个网站都显示“安全警告”

→ CA certificate not installed. Run
python main.py --install-cert
or follow the manual install steps above.
→ 未安装CA证书。运行
python main.py --install-cert
或按照上述手动安装步骤操作。

Connection refused on port 8085

8085端口连接被拒绝

→ Check
listen_host
and
listen_port
in
config.json
. Make sure
python3 main.py
is running.
→ 检查
config.json
中的
listen_host
listen_port
。确保
python3 main.py
正在运行。

"403 Forbidden" from relay

中继返回“403 Forbidden”

auth_key
in
config.json
does not match
AUTH_KEY
in deployed
Code.gs
. Redeploy the script after fixing.
config.json
中的
auth_key
与已部署的
Code.gs
中的
AUTH_KEY
不匹配。修复后重新部署脚本。

Google Apps Script quota exceeded

Google Apps Script配额超限

→ Free tier has daily quotas. Add more
script_ids
in
config.json
for load balancing across multiple deployments.
→ 免费版有每日配额限制。在
config.json
中添加更多
script_ids
,通过多个部署实现负载均衡。

verify_ssl
errors

verify_ssl
错误

json
{ "verify_ssl": false }
Use only for testing; not recommended for production.
json
{ "verify_ssl": false }
仅用于测试;不推荐在生产环境中使用。

Regenerate CA certificate

重新生成CA证书

bash
rm -rf ca/
python3 main.py  # generates new ca/ca.crt on startup
bash
rm -rf ca/
python3 main.py  # 启动时会生成新的ca/ca.crt

Then reinstall the certificate in OS/browser

然后在操作系统/浏览器中重新安装证书

undefined
undefined

Can't install Python packages (behind firewall)

无法安装Python包(防火墙环境下)

bash
pip install -r requirements.txt \
  -i https://mirror-pypi.runflare.com/simple/ \
  --trusted-host mirror-pypi.runflare.com
bash
pip install -r requirements.txt \
  -i https://mirror-pypi.runflare.com/simple/ \
  --trusted-host mirror-pypi.runflare.com

Test the proxy is working

测试代理是否正常工作

bash
undefined
bash
undefined

Should return your external IP routed through Google

返回通过Google路由的外部IP

Project Structure

项目结构

MasterHttpRelayVPN/
├── main.py              # Entry point, starts HTTP + SOCKS5 listeners
├── setup.py             # Interactive config wizard
├── config.json          # Your configuration (gitignored)
├── config.example.json  # Template
├── requirements.txt     # Python dependencies
├── apps_script/
│   └── Code.gs          # Google Apps Script relay code
├── ca/
│   ├── ca.crt           # Generated CA certificate (install this)
│   └── ca.key           # CA private key (keep secret)
├── start.sh             # Linux/macOS quick start
└── start.bat            # Windows quick start
MasterHttpRelayVPN/
├── main.py              # 入口文件,启动HTTP + SOCKS5监听器
├── setup.py             # 交互式配置向导
├── config.json          # 你的配置文件(已加入git忽略)
├── config.example.json  # 配置模板
├── requirements.txt     # Python依赖
├── apps_script/
│   └── Code.gs          # Google Apps Script中继代码
├── ca/
│   ├── ca.crt           # 生成的CA证书(需安装)
│   └── ca.key           # CA私钥(需保密)
├── start.sh             # Linux/macOS快速启动脚本
└── start.bat            # Windows快速启动脚本