Files
cellular-proxy/README.md
T
Hermes ccace51535 feat: 增量升级路径 --upgrade / --ui-only
- 已装机器默认自动走升级,保留 secret/网卡/账密
- 默认不重下 sing-box、不 rebind、不 verify
- scripts/upgrade.sh + install.sh 入口 + README
2026-07-21 12:48:00 +00:00

155 lines
5.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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 '代理密码'
```
| 选项 | 说明 |
|------|------|
| (无参数) | 全自动探测 + 绑定 + 安装 + 启动;**若已安装则自动改走增量升级** |
| `--upgrade` | 强制增量升级(保留密钥/网卡) |
| `--ui-only` | 只更新 9090 面板 |
| `--force-binary` | 升级时强制重下 sing-box |
| `--rebind` | 升级时重新探测数据网卡 |
| `--verify` | 升级后做出口验证(升级默认跳过) |
| `--force-install` | 已安装也走全量安装流程(仍尽量沿用 live settings |
| `--iface` | 强制指定数据网卡 |
| `--secret` | 面板密钥(默认随机;升级不改已有) |
| `--user` / `--pass` | 代理鉴权 |
| `--port` / `--panel-port` | 默认 7890 / 9090 |
| `--memory` | MemoryMax MB,默认 96 |
| `--skip-start` / `--skip-verify` | 跳过启动或验证 |
## 增量升级(推荐,已装机器)
**不必整包重装。** 升级路径会:
| 保留 | 默认跳过 | 会更新 |
|------|----------|--------|
| `settings.conf` / `PANEL_SECRET` / 代理账密 | 重下 sing-box(已存在则复用) | UI 面板 |
| `CELLULAR_IFACE` 绑定 | 重新探测网卡 | scripts / `cpxy` / systemd unit |
| 端口与 MemoryMax | 出口公网验证 | 重生 `config.json` 并 restart |
```bash
# 标准增量升级(最快:不下二进制、不 rebind、不 verify
curl -fsSL 'https://gitea.chickliu.fun/Hermes/cellular-proxy/raw/branch/main/install.sh' | sudo bash -s -- --upgrade
# 只刷 animal-island 面板
curl -fsSL 'https://gitea.chickliu.fun/Hermes/cellular-proxy/raw/branch/main/install.sh' | sudo bash -s -- --upgrade --ui-only
# 强制更新 sing-box 二进制
curl -fsSL 'https://gitea.chickliu.fun/Hermes/cellular-proxy/raw/branch/main/install.sh' | sudo bash -s -- --upgrade --force-binary
# 升级后顺带验证出口
curl -fsSL 'https://gitea.chickliu.fun/Hermes/cellular-proxy/raw/branch/main/install.sh' | sudo bash -s -- --upgrade --verify
```
> 再次无参执行 `... | sudo bash` 时,若检测到 `/opt/cellular-proxy/etc/settings.conf`,也会**自动切换为升级**(避免误重置密钥)。全量重装请显式 `--force-install`。
装完 / 升级后:
```bash
cpxy verify # 直连 IP ≠ 代理 IP
cpxy rebind # 重插卡后重新自动探测并绑定
cpxy detect # 查看评分/驱动
cpxy status | logs
cpxy auth --user u --pass p # 设置 7890 代理账号密码
cpxy auth --show # 查看鉴权状态
cpxy auth --clear # 清除鉴权
cpxy upgrade # 打印在线升级命令
```
- 代理:`LAN-IP:7890`HTTP + SOCKS5
- 面板:`http://LAN-IP:9090/ui/`(密钥在安装结束输出 / `settings.conf`
- **UI 可直接配置代理账号密码**(管理 API 默认 `9091`,与面板 secret 相同)
## 自动探测逻辑(摘要)
按分数选择,优先:
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
- 中文静态面板(animal-island-ui 视觉 token,单文件无 React
- 默认 `MemoryMax=96MB`
## 二进制从哪里下?
**优先 Gitea Release 预置包**(一键安装默认走 Gitea,无需访问 GitHub):
```text
https://gitea.chickliu.fun/Hermes/cellular-proxy/releases/download/bin-v1.11.7/sing-box-1.11.7-linux-amd64.tar.gz
https://gitea.chickliu.fun/Hermes/cellular-proxy/releases/download/bin-v1.11.7/sing-box-1.11.7-linux-arm64.tar.gz
https://gitea.chickliu.fun/Hermes/cellular-proxy/releases/download/bin-v1.11.7/sing-box-1.11.7-linux-armv7.tar.gz
```
下载顺序:`Gitea 整包``Gitea 分片合并(兜底)``GitHub 代理(https://git.86482425.xyz)``直连 GitHub`
## 代理账号密码(更优雅的方式)
| 方式 | 说明 |
|------|------|
| **面板 UI** | 打开 `http://LAN-IP:9090/ui/`,填 secret → 「代理账号密码」保存 |
| **CLI** | `sudo cpxy auth --user u --pass p` |
| **安装时** | `--user` / `--pass` |
| **改文件** | `settings.conf``PROXY_USER` / `PROXY_PASS``cpxy generate` |
管理 API`POST http://LAN-IP:9091/proxy-auth`Header `Authorization: Bearer <PANEL_SECRET>`
维护者更新预置包(从 GitHub 经代理拉再上传 Gitea):
```bash
set -a; source ~/.hermes/env/gitea.env; set +a
ARCHS='amd64 arm64 armv7' ./scripts/publish-binaries-to-gitea.sh
```
## 安全
局域网监听建议设置 `--user/--pass`;面板 secret 已默认随机生成。
`REQUIRE_CELLULAR_IFACE=true`:数据口不在则不装/不生成假出口。