feat: bind_interface-only by default + WWAN watch auto-rebind

- Default BIND_SOURCE_IP=false: do not pin inet4_bind_address (stale
  source IP after WWAN re-dial was the main rep=0x01 cause).
- Add scripts/watch-cellular.sh: ip monitor events + poll, regenerate
  when iface missing or pinned source IP drifts.
- systemd: cellular-proxy-watch.service + 2min timer oneshot fallback.
- cpxy watch {status|once|start|stop|logs}
- Install/upgrade enable watch when ENABLE_CELLULAR_WATCH=true.
This commit is contained in:
Hermes Agent
2026-07-23 09:02:46 +00:00
parent 062a3eee90
commit 06f941c519
10 changed files with 381 additions and 7 deletions
+9 -1
View File
@@ -17,12 +17,20 @@ LOG_DIR=/var/log/cellular-proxy
# ---- 数据网卡(代理出口强制绑定)----
# 留空则自动探测 wwan/usb/enx 等;建议手动填准
CELLULAR_IFACE=
# 可选:数据侧源 IPv4一般留空
# 元数据:数据侧当前源 IPv4generate/watch 会更新;默认不写入 sing-box
CELLULAR_SOURCE_IP=
# 是否把源 IP pin 进 sing-box inet4_bind_address
# false(默认,推荐):只 bind_interface=网卡名 → WWAN 重拨换私网 IP 时通常无需 regenerate
# true:额外写 inet4_bind_address(需 watch/rebind 同步,否则易 stale → SOCKS rep=0x01
BIND_SOURCE_IP=false
# 数据网卡不存在则不启动(推荐 true,避免代理静默从 WiFi 出)
REQUIRE_CELLULAR_IFACE=true
# 自动探测关键词(逗号分隔)
CELLULAR_IFACE_PATTERNS=wwan,wwp,usb,enx,ppp,cdc
# 后台监控(推荐开):网卡改名/掉线/无 IPv4 时自动 rebind;默认开启 long-running watch
ENABLE_CELLULAR_WATCH=true
# watch 轮询兜底间隔秒(事件驱动 ip monitor 为主)
WATCH_INTERVAL_SEC=60
# ---- 代理监听(局域网其它设备用 0.0.0.0)----
# mixed = 同一端口同时支持 HTTP 代理 与 SOCKS5