fix(diag): host 参数走 base64 避免 GFW 拦明文敏感词诊断请求
控制面跑明文 HTTP 在国外 IP 上,白盒诊断请求 URL 里出现 google/youtube 等 GFW 敏感词时被墙重置(返回空)→ 出海段拿不到、报告显示「—」。改:host 用 base64url 传(host_b64),响应也回 b64、不回明文,明文里无敏感词(不影响真实加密隧道流量)。 - diag.go: EgressTiming 支持 ?host_b64=,解码后查白名单,响应 echo b64 - vpn_whitebox.py: node_egress 用 base64url 编码 host 验证:cara(墙内)google/youtube 出海段从 None → 8-9ms,与 github/cloudflare 一致。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -111,9 +111,13 @@ def echo_ip(urls):
|
||||
def node_egress(host):
|
||||
"""量「节点→目标」出海段。优先走控制面诊断端点(HTTP,无需 SSH),
|
||||
回退到 NODE_SSH(curl)。返回 dict{tls_ms,dns_ms,ttfb_ms} 或 None。"""
|
||||
# 1) 控制面诊断端点 /v1/diag/egress(节点本机量出海段)
|
||||
# 1) 控制面诊断端点 /v1/diag/egress(节点本机量出海段)。
|
||||
# host 用 base64url 传(host_b64):控制面是国外 IP 上的明文 HTTP,URL 里出现
|
||||
# google/youtube 等敏感词会被 GFW 重置;base64 后明文不含敏感词,避免诊断被拦。
|
||||
import base64
|
||||
hb = base64.urlsafe_b64encode(host.encode()).rstrip(b"=").decode()
|
||||
try:
|
||||
u = CONTROL_PLANE.rstrip("/") + "/v1/diag/egress?host=" + host
|
||||
u = CONTROL_PLANE.rstrip("/") + "/v1/diag/egress?host_b64=" + hb
|
||||
with urllib.request.urlopen(u, timeout=TIMEOUT, context=_ctx()) as resp:
|
||||
d = json.load(resp)
|
||||
if d.get("tls_ms") is not None:
|
||||
|
||||
Reference in New Issue
Block a user