v1.3.19 feat: add real-time traffic stats and speed up CDN probe

- add real-time traffic stats via clash_api: total in/out shown in `sb -n` output and main menu status line
- inject `experimental.clash_api` into the base config, with a fallback patch plus SIGHUP reload for legacy configs and cleanup of stale `v2ray_api`
- add shared `find_free_port()` for both the nginx default port and the clash_api port, probing for unused ports within the script port range
- add `format_traffic()` and `ensure_stats_data()` helpers, fetching `/connections` with curl-first, wget fallback
- speed up the CDN status probe with HEAD requests and explicit timeouts in `get_code()`

v1.3.19 feat: 新增实时流量统计,加速优选地址探测

- 新增基于 clash_api 的实时流量统计:`sb -n` 输出与主菜单状态行展示总入站/出站流量
- 基础配置注入 `experimental.clash_api`,旧配置自动补全并 SIGHUP 热加载,同时清理残留的 `v2ray_api`
- 新增公共 `find_free_port()`,nginx 默认端口与 clash_api 端口共用,在脚本端口范围内探测未被占用的端口
- 新增 `format_traffic()` 与 `ensure_stats_data()` 辅助函数,优先 curl、wget 兜底拉取 `/connections` 数据
- 加速优选地址状态探测:`get_code()` 改用 HEAD 请求并显式设置超时
This commit is contained in:
fscarmen
2026-07-31 15:38:40 +00:00
parent eb5c5a32c7
commit 09036481c9
2 changed files with 262 additions and 91 deletions
+4 -2
View File
@@ -24,16 +24,18 @@
* * *
## 1.更新信息
2026.07.31 v1.3.19 Add real-time traffic stats (-n / main menu); 添加实时流量统计 (-n / 主菜单)
2026.07.25 v1.3.18 Add enable/disable subscriptions option in sb -d menu 2. Change v2rayN Hysteria2 Realm config from Finalmask field to ProtoExtraObj; sb -d 菜单新增 「订阅开关」,可随时开启关闭订阅
2026.07.20 v1.3.17 1. Add SIGHUP hot-reload support, replace restart sequences with reload; 2. Force base-config regeneration on upgrade to guarantee sing-box check passes; 1. 新增 SIGHUP 热更支持,用 reload 替换重启流程; 2. 升级时强制重置基础配置至新版格式,保证兼容性
2026.07.16 v1.3.16 1. Add bind_interface option in sb -d menu to bind outbound traffic to a specific NIC; 2. Change v2rayN Hysteria2 Realm config from Finalmask field to ProtoExtraObj; 1. sb -d 菜单新增「指定网络出口」选项,可为出站流量绑定特定网卡; 2. v2rayN 的 Hysteria2 Realm 配置从 Finalmask 字段改为 ProtoExtraObj
<details>
<summary>历史更新 history(点击即可展开或收起)</summary>
<br>
>2026.07.16 v1.3.16 1. Add bind_interface option in sb -d menu to bind outbound traffic to a specific NIC; 2. Change v2rayN Hysteria2 Realm config from Finalmask field to ProtoExtraObj; 1. sb -d 菜单新增「指定网络出口」选项,可为出站流量绑定特定网卡; 2. v2rayN 的 Hysteria2 Realm 配置从 Finalmask 字段改为 ProtoExtraObj
>
>2026.07.01 v1.3.15 Add v2rayN Finalmask field for hysteria2 realm subscription output; v2rayN 订阅输出增加 Hysteria2 Realm 的 Finalmask 字段
>
>2026.05.29 v1.3.14 Added optional custom warp route rule management, available after installation via [sb -d] without affecting the main installation flow; 增加可选的自定义 warp 路由规则管理,不影响主程序安装流程,安装后可通过 [sb -d] 按需管理