3 Commits
Author SHA1 Message Date
aaaamoooo d9bf21a847 agent: default sing-box stats API port 10086 -> 10089
CI / test (push) Waiting to run
CI / anytls-smoke (push) Waiting to run
Avoids the v2ray_api listen colliding with L-UI's fixed 10086 on
dual-homed nodes. NG_SINGBOX_API_PORT env still overrides. Aligns the
stats-query --server default and the doctor script fallback to the
same value. Agent version stays 0.6.8.
2026-10-23 12:33:00 +00:00
aaaamoooo 1486a67124 docs(readme): panel is Go now — drop Node.js description, correct memory figures (panel ~15MB)
CI / test (push) Canceled after 0s
CI / anytls-smoke (push) Canceled after 0s
2026-10-21 22:41:28 +08:00
rogue 733ec38022 更新 README.md
CI / test (push) Canceled after 0s
CI / anytls-smoke (push) Canceled after 0s
2026-10-21 22:31:31 +08:00
4 changed files with 8 additions and 15 deletions
+5 -12
View File
@@ -4,7 +4,7 @@
## 架构 ## 架构
- **主控**:Node.js 面板(约 61MB),跑在 OpenWrt 路由器或任意 Linux 上。管理节点、客户、订阅,下发配置到各 Agent。 - **主控**:Go 静态二进制面板(约 13-30MB),跑在 OpenWrt 路由器或任意 Linux 上,无运行时依赖。管理节点、客户、订阅,下发配置到各 Agent。
- **Agent**:跑在节点机上,通过 token 注册。管理 sing-box 进程,上报心跳和按用户流量。 - **Agent**:跑在节点机上,通过 token 注册。管理 sing-box 进程,上报心跳和按用户流量。
## 与原版的区别 ## 与原版的区别
@@ -13,20 +13,13 @@
- 3x-ui 式共享节点:nodes 状态机 + 每个客户独立凭据(`ng:<customerId>` 身份) - 3x-ui 式共享节点:nodes 状态机 + 每个客户独立凭据(`ng:<customerId>` 身份)
- 全面 sing-box:不再捆绑 xray - 全面 sing-box:不再捆绑 xray
- 按用户流量统计:AnyTLS 走日志解析,SS 走节点级 - 按用户流量统计:AnyTLS 走日志解析,SS 走节点级
- 内存优化:面板 `node --max-old-space-size=128 --optimize-for-size`;Agent 为 Go 静态二进制(约 12MB,节点机无需 Node.js);sing-box `GOMEMLIMIT=64MiB GOGC=50` - 内存优化:主控与 Agent 均为 Go 静态二进制、无 Node.js 依赖(主控约 13-30MB、Agent 约 12MB);主控可加 `GOMEMLIMIT=28MiB GOGC=50` 压内存,sing-box 服务为 `GOMEMLIMIT=64MiB GOGC=50`
## 安装 ## 安装
### 主控 ### 主控
```bash 主控是 Go 静态二进制 `nexusgate-panel`(panel-go/),无运行时依赖,数据放在 `/etc/nexusgate`。部署与换装步骤见 `panel-go/INSTALL-GO.md`。
# 克隆仓库
git clone https://git.881218.xyz/rogue/NexusGate.git /opt/nexusgate
cd /opt/nexusgate
# 安装依赖并启动
node --max-old-space-size=128 --optimize-for-size server.js
```
面板地址:`http://IP:8787`,默认账号 `admin`。 面板地址:`http://IP:8787`,默认账号 `admin`。
@@ -48,11 +41,11 @@ Agent 是 Go 静态二进制,安装时从 Gitea Release 下载,节点机不
VLESS / SS2022 / SS经典 / SOCKS5 / Hysteria2 / AnyTLS VLESS / SS2022 / SS经典 / SOCKS5 / Hysteria2 / AnyTLS
## 内存占用(实测 2026-10-20,三台节点机) ## 内存占用(实测 2026-10-21)
| 组件 | 内存 | | 组件 | 内存 |
|---|---| |---|---|
| 主控面板 | 约 61MB(OpenWrt 路由器) | | 主控面板 | 约 13-30MB(Go 静态二进制,OpenWrt 路由器) |
| Agent | 约 12MB(Go 静态二进制) | | Agent | 约 12MB(Go 静态二进制) |
| sing-box | 16–36MB | | sing-box | 16–36MB |
+1 -1
View File
@@ -82,7 +82,7 @@ func loadConfig() config {
KeyFile: envOr("NG_KEY_FILE", "/etc/nexusgate/keys.json"), KeyFile: envOr("NG_KEY_FILE", "/etc/nexusgate/keys.json"),
SessionTokenFile: envOr("NG_SESSION_TOKEN_FILE", root+"/session-token.json"), SessionTokenFile: envOr("NG_SESSION_TOKEN_FILE", root+"/session-token.json"),
TLSDir: envOr("NG_TLS_DIR", "/etc/nexusgate/tls"), TLSDir: envOr("NG_TLS_DIR", "/etc/nexusgate/tls"),
APIPort: envOr("NG_SINGBOX_API_PORT", "10086"), APIPort: envOr("NG_SINGBOX_API_PORT", "10089"),
PollMS: int64(pollSec * 1000), PollMS: int64(pollSec * 1000),
} }
} }
+1 -1
View File
@@ -16,7 +16,7 @@ import (
) )
func main() { func main() {
server := flag.String("server", "127.0.0.1:10086", "sing-box statistics API address") server := flag.String("server", "127.0.0.1:10089", "sing-box statistics API address")
flag.Parse() flag.Parse()
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel() defer cancel()
+1 -1
View File
@@ -27,7 +27,7 @@ elif [[ -x /usr/local/bin/nexusgate-sing-box ]]; then
if [[ -f /etc/nexusgate/sing-box/config.json ]]; then if [[ -f /etc/nexusgate/sing-box/config.json ]]; then
/usr/local/bin/nexusgate-sing-box check -c /etc/nexusgate/sing-box/config.json 2>&1 | tail -n 12 /usr/local/bin/nexusgate-sing-box check -c /etc/nexusgate/sing-box/config.json 2>&1 | tail -n 12
printf '入站流量统计(累计):\n' printf '入站流量统计(累计):\n'
/usr/local/bin/nexusgate-sing-box-stats --server="127.0.0.1:${NG_SINGBOX_API_PORT:-10086}" 2>&1 | head -c 900 /usr/local/bin/nexusgate-sing-box-stats --server="127.0.0.1:${NG_SINGBOX_API_PORT:-10089}" 2>&1 | head -c 900
printf '\n' printf '\n'
else else
printf '已安装,当前没有节点资源\n' printf '已安装,当前没有节点资源\n'