Files
Hermes-Skills/longbridge-cli/references/clash-node-switching.md
T
mikeandClaude af6aa8d7b8 feat(longbridge): 602315 mainland CN geo-block bypass + stock_t通用脚本
- SKILL.md: 加 602315 bypass 章节(三件套 LONGBRIDGE_REGION + proxychains + Clash HK)
- longbridge-python-sdk/SKILL.md: Python SDK 路径同样需要 bypass
- references/longbridge-602315-bypass.md: 完整方案+验证步骤
- references/longbridge-cn-vs-com-endpoint.md: cn vs com 域名区别
- references/clash-node-switching.md: Clash 切香港节点操作
- references/stock-t-trading-workflow.md: 通用持仓脚本用法
- intraday-trading/SKILL.md: 同步 602315 限制说明
- scripts/{daily_t_analysis,t_monitor}.py: 之前漏提交,补上

验证: 2026-07-09 下单 RGTI 15股@15.50 订单ID 1259547163696824320 成功
背景: longport SDK 通过 is_cn() 自动探测 geotest.lbkrs.com 选 cn/com endpoint
     net_mode下 cn 域(阿里云深圳)被拒,com 域(AWS香港)需绕
     唯一可行: LONGBRIDGE_REGION=ap 强制走 com + proxychains + Clash 香港出口

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-09 00:45:25 +08:00

2.7 KiB

Clash/Mihomo 节点切换 — for proxychains 602315 bypass setup

This file is part of the LONGBRIDGE_REGION=ap + proxychains + Clash HK bypass workflow. It documents how to switch the Mihomo proxy's GLOBAL selector to a Hong Kong node (a prerequisite for the longbridge 602315 bypass — see references/longbridge-602315-bypass.md).

Why this still matters: even though the bypass uses LONGBRIDGE_REGION=ap to force the SDK onto .com, the proxychains4 wrapper still needs a HK exit IP so the .com endpoint is reachable. That means the Clash node behind 127.0.0.1:7890 must be on 🇭🇰 [Lv2] 香港 01/02/03.

Critical pitfall: selector group PUT may report success but not stick

When you PUT to GLOBAL / 自动选择 / 故障转移, the API returns 204 and now briefly shows the new node, but on the next probe (a few seconds later) now reverts to None or to whatever 自动选择 URL-tested. Mihomo's selector-cache race condition makes these top-level groups unreliable for permanent pinning.

Use the raw subscription group name instead (URL-encode the space):

# Pin to 🇭🇰 香港 01 in BiXin Network (the raw subscription group)
curl -X PUT 'http://127.0.0.1:9090/proxies/BiXin%20Network' \
  -H 'Content-Type: application/json' \
  -d '{"name":"🇭🇰 [Lv2] 香港 01"}'

# Verify the pin stuck
sleep 2
curl -s 'http://127.0.0.1:9090/proxies/BiXin%20Network' | python3 -c "
import json,sys; print('now:', json.load(sys.stdin).get('proxy',{}).get('now'))
"
# Should print: now: 🇭🇰 [Lv2] 香港 01

Confirm HK exit

curl -x http://127.0.0.1:7890 --max-time 10 https://ipinfo.io/json
# Expected: "country": "HK", "city": "Hong Kong" or similar
# IP usually 154.83.x.x (Cox/Catixs HK block)

If exit shows a CN or US IP, the pin didn't stick — re-PUT or check that the BiXin Network selector actually contains the HK node in its all list.

List nodes that include HK

curl -s http://127.0.0.1:9090/proxies | python3 -c "
import json,sys
d = json.load(sys.stdin)
for gn, g in d.get('proxies', {}).items():
    if isinstance(g, dict):
        all_nodes = g.get('all', [])
        hk = [n for n in all_nodes if '香港' in n or 'HK' in n or '🇭🇰' in n]
        if hk:
            print(f'{gn}: {hk[:3]}')
"

Limitations

  • Clash HTTP proxy does not route Rust SDK HTTPS calls directly — that's what proxychains4 does for the bypass. Clash alone is not enough for 602315.
  • Pinning is per-group. If multiple scripts run simultaneously and one of them sets GLOBAL directly, the BiXin Network pin survives but global traffic may shift.
  • If Mihomo config gets reloaded (e.g. ~/.hermes/scripts/update-sub.sh auto-runs), you may need to re-pin.