|
|
před 17 hodinami | |
|---|---|---|
| scripts | před 17 hodinami | |
| substore | před 17 hodinami | |
| .gitignore | před 1 týdnem | |
| CLAUDE.md | před 17 hodinami | |
| README.md | před 17 hodinami | |
| build_router_package.sh | před 17 hodinami | |
| config.local.json | před 17 hodinami | |
| config.server.json | před 1 týdnem | |
| config_router.conf | před 17 hodinami | |
| workflow.md | před 17 hodinami |
用于选择优选目标并产出运行时文件,支持三种模式:
runtime-state)cfst 模式(本机 cfst -> IP)sh + cfst -> IP + HTTP 暴露)核心脚本:
scripts/domain_updater.py:Python 主入口(api / cfst_local)scripts/run_update_and_commit.sh:服务器模式调度入口(含 git 同步)scripts/install_debian.sh / scripts/uninstall_debian.sh:systemd 安装/卸载scripts/router_local_update.sh:路由器更新入口(BusyBox sh)scripts/router_local_http.sh:路由器 HTTP 入口(BusyBox httpd)build_router_package.sh:路由器部署包打包脚本(生成 vmess.tar.gz)配置文件:
config.server.json:服务器模式config.local.json:本地 Python cfst 模式config_router.conf:BusyBox 路由器模式旧
config.json/config.example.json已废弃。
三种模式都围绕同类输出:
默认目录:
runtime/cfip_runtime/python3runtime-statepython3 scripts/domain_updater.py --config config.server.json
bash scripts/run_update_and_commit.sh config.server.json
强制提交:
bash scripts/run_update_and_commit.sh --force-commit config.server.json
# 或
GIT_FORCE_COMMIT=1 bash scripts/run_update_and_commit.sh config.server.json
# 语法检查
env PYTHONPYCACHEPREFIX=/tmp/pycache python3 -m py_compile scripts/domain_updater.py
bash -n scripts/run_update_and_commit.sh
# 查看解析后的输出路径
python3 scripts/domain_updater.py --config config.server.json --print-output-settings
# systemd(Debian/Ubuntu)
sudo bash scripts/install_debian.sh --config config.server.json
sudo systemctl status vmess-domain-rotator.timer
sudo systemctl status vmess-domain-rotator.service
sudo systemctl start vmess-domain-rotator.service
sudo journalctl -u vmess-domain-rotator.service -n 120 --no-pager
# 卸载
sudo bash scripts/uninstall_debian.sh
cfst 模式python3cfstpython3 scripts/domain_updater.py --config config.local.json
默认配置当前指向:
cfst_local.work_dir = ./cfst_linux_armv5cfst_local.binary = ./cfst./cfip_runtime# 输出文件检查
cat cfip_runtime/current_ip.txt
cat cfip_runtime/current_ip.json
cat cfip_runtime/state.json
cat cfip_runtime/substore_vars.json
# 仅检查输出路径解析
python3 scripts/domain_updater.py --config config.local.json --print-output-settings
cfsthttpd applet)/jffs/vmess/
├── busybox_armv7l
├── config_router.conf
├── scripts/
│ ├── router_local_update.sh
│ └── router_local_http.sh
└── cfst/
├── cfst
├── ip.txt
└── result.csv
config_router.conf)CFST_WORK_DIR / CFST_BIN / CFST_RESULT_FILECFST_SPEED_LIMIT(建议设置,如 5)RUNTIME_DIR / VALUE_TEXT_FILE / VALUE_JSON_FILEBUSYBOX_BIN(如 ./busybox_armv7l)HTTP_PORT(默认 8080)cd /jffs/vmess
sh scripts/router_local_update.sh ./config_router.conf
sh scripts/router_local_http.sh ./config_router.conf
说明:
cfst 原始输出(便于排错)cfst,只保留 [router-local] 摘要BUSYBOX_BIN 指向的 BusyBox httpd,不使用 ASUS 系统 httpd/jffs/scripts/services-start)VMESS_DIR="/jffs/vmess"
CONFIG="./config_router.conf"
UPDATE_LOG="/tmp/router_local_update.log"
HTTP_LOG="/tmp/router_http.log"
HTTP_PROCESS_PATTERN='[r]outer_local_http.sh'
start_vmess_http() {
if ps | grep -q "$HTTP_PROCESS_PATTERN"; then
return 0
fi
cd "$VMESS_DIR" || exit 1
nohup sh scripts/router_local_http.sh "$CONFIG" >> "$HTTP_LOG" 2>&1 &
}
cd "$VMESS_DIR" || exit 1
# 避免开机过早导致 result.csv 为空
sleep 60
i=1
while [ "$i" -le 5 ]; do
if sh scripts/router_local_update.sh "$CONFIG" >> "$UPDATE_LOG" 2>&1; then
break
fi
sleep 20
i=$((i + 1))
done
cru d vmess_rotate
cru a vmess_rotate "0 */3 * * * cd $VMESS_DIR && sh scripts/router_local_update.sh $CONFIG >> $UPDATE_LOG 2>&1"
sleep 10
start_vmess_http
cru d vmess_watchdog
cru a vmess_watchdog "*/5 * * * * if ! ps | grep -q '$HTTP_PROCESS_PATTERN'; then cd $VMESS_DIR && nohup sh scripts/router_local_http.sh $CONFIG >> $HTTP_LOG 2>&1 & fi"
# 基础检查
cd /jffs/vmess
chmod +x busybox_armv7l
./busybox_armv7l --list | grep '^httpd$'
# 更新与结果检查
sh scripts/router_local_update.sh ./config_router.conf
cat cfip_runtime/current_ip.txt
cat cfip_runtime/current_ip.json
cat cfip_runtime/state.json
# HTTP 与端口检查
sh scripts/router_local_http.sh ./config_router.conf
ps | grep router_local_http.sh
netstat -lntp | grep ':8080'
curl http://127.0.0.1:8080/current_ip.txt
# 常见端口冲突处理(Address already in use)
# 1) 改 config_router.conf 的 HTTP_PORT
# 2) 或停止旧进程后重启
substore/operator_template.js 支持:
VALUE_SOURCE_MODE = "default":路由器优先,低速时切服务器VALUE_SOURCE_MODE = "server_only":只用服务器VALUE_SOURCE_MODE = "router_only":只用路由器速度阈值使用 MB/s:
ROUTER_MIN_SPEED_MB_PER_S = 5download_speed 纯数字按 MB/s 解释./build_router_package.sh
可选覆盖:
BUSYBOX_SRC="/path/to/busybox_armv7l" \
CFST_SRC_DIR="/path/to/cfst_dir" \
OUT_TAR="/path/to/vmess.tar.gz" \
./build_router_package.sh
打包内容默认为:
vmess/busybox_armv7lvmess/config_router.confvmess/scripts/router_local_update.shvmess/scripts/router_local_http.shvmess/cfst/*state.json 需持久化,否则 fallback 不可用。httpd,不要依赖系统精简 httpd / nc。