fix: 安装启动后不再卡住,保证脚本退出

- 去掉可能阻塞的 systemctl status 全量输出
- verify 使用 connect/max 超时;安装阶段 8s 快速验证
- 验证失败只告警,不阻塞安装结束
This commit is contained in:
Hermes
2026-07-21 11:26:30 +00:00
commit aec388682b
14 changed files with 1697 additions and 0 deletions
+97
View File
@@ -0,0 +1,97 @@
# cellular-proxy
轻量 **「走代理 = 走数据流量」**(无 frp,512MB 友好)。
## 语义
| 流量 | 出口 |
|------|------|
| **不走** 本代理 | 系统默认(通常 WiFi) |
| **走** 本代理 | **一律数据网卡**(自动探测并 bind |
## 全自动一键安装
无参数即可:
1. 下载源码
2. **自动探测数据网卡**(名称 / 驱动 / 次要默认路由 / 非默认物理口)
3. **写入配置并 bind 出口**
4. 安装 sing-box + systemd
5. 启动并尝试验证出口 IP
```bash
curl -fsSL 'https://gitea.chickliu.fun/Hermes/cellular-proxy/raw/branch/main/install.sh' | sudo bash
```
可选覆盖:
```bash
curl -fsSL 'https://gitea.chickliu.fun/Hermes/cellular-proxy/raw/branch/main/install.sh' | sudo bash -s -- \
--iface wwan0 \
--secret '面板密钥' \
--user proxy \
--pass '代理密码'
```
| 选项 | 说明 |
|------|------|
| (无参数) | 全自动探测 + 绑定 + 安装 + 启动 |
| `--iface` | 强制指定数据网卡 |
| `--secret` | 面板密钥(默认随机) |
| `--user` / `--pass` | 代理鉴权 |
| `--port` / `--panel-port` | 默认 7890 / 9090 |
| `--memory` | MemoryMax MB,默认 96 |
| `--skip-start` / `--skip-verify` | 跳过启动或验证 |
装完:
```bash
cpxy verify # 直连 IP ≠ 代理 IP
cpxy rebind # 重插卡后重新自动探测并绑定
cpxy detect # 查看评分/驱动
cpxy status | logs
```
- 代理:`LAN-IP:7890`HTTP + SOCKS5
- 面板:`http://LAN-IP:9090/`(密钥在安装结束输出 / `settings.conf`
## 自动探测逻辑(摘要)
按分数选择,优先:
1. 驱动像蜂窝/USB 拨号:`qmi_wwan``cdc_mbim``cdc_ether``rndis_host`
2. 名称含:`wwan` / `wwp` / `usb` / `enx` / `ppp` / `rmnet` / `ccmni`
3. **不是** 系统默认路由网卡(默认通常是 WiFi)
4. 多默认路由时取次要默认口
5. 回退:任意非默认且有 IPv4 的物理网卡
探测失败会直接报错并提示用 `--iface`
## 手动安装
```bash
git clone https://gitea.chickliu.fun/Hermes/cellular-proxy.git
cd cellular-proxy
sudo ./scripts/install.sh # 同样会自动探测并绑定
```
## 资源
- 单进程 sing-box
- 中文静态面板 ~20KB
- 默认 `MemoryMax=96MB`
## GitHub 下载代理
安装时下载 sing-box release 默认走:
```text
https://git.86482425.xyz/https://github.com/SagerNet/sing-box/releases/...
```
可在 `settings.conf``GITHUB_PROXY=`(置空则直连 GitHub)。代理失败会自动回退直连。
## 安全
局域网监听建议设置 `--user/--pass`;面板 secret 已默认随机生成。
`REQUIRE_CELLULAR_IFACE=true`:数据口不在则不装/不生成假出口。