Pure-stdlib Go implementation of the whole control plane: same nexusgate.json schema (unknown fields preserved verbatim, explicit null/false tri-states modeled), same HTTP API and error strings, embedded frontend (NG_PUBLIC_DIR override), self-implemented scrypt auth, X25519 Reality keys, panel-hosted keyStore and heartbeat reconciliation included. Version stays 0.6.8. Verified: Go tests 33/33 (scrypt + Reality vectors generated from the Node implementation, subscription goldens byte-identical), Node suite 52/52 untouched, differential E2E against the Node panel 50/50 including two-way DB swap. See panel-go/PARITY.md and panel-go/INSTALL-GO.md.
2.7 KiB
NexusGate 面板 Go 版 — 部署与回滚(路由器主控)
Go 版面板是单文件静态二进制:前端已 embed、零运行时依赖、读写与 Node
版同一个 nexusgate.json。切换只是把 procd 的启动命令从 node 换成
二进制,环境变量与数据文件都不动;agent 协议与版本串(0.6.8)不变,
节点机无需任何改动。
产物
| 架构 | 文件 | 用途 |
|---|---|---|
| arm64 | nexusgate-panel-linux-arm64 |
AX6600 路由器(主控) |
| amd64 | nexusgate-panel-linux-amd64 |
x86 服务器/VPS |
部署(OpenWrt 主控)
-
把 arm64 二进制放到路由器,如
/opt/nexusgate/nexusgate-panel:chmod +x /opt/nexusgate/nexusgate-panel -
先单独冒烟(用现有库与空闲端口,不停现服务):
NG_DATA_FILE=/etc/nexusgate/data/nexusgate.json NG_PORT=8899 /opt/nexusgate/nexusgate-panel # 另一终端: curl http://127.0.0.1:8899/healthz → {"ok":true,"version":"0.6.8",...}数据库已有管理员用户,不会触发 BOOTSTRAP;冒烟完 Ctrl-C 停掉。
-
改 procd 服务
/etc/init.d/nexusgate的启动命令:把node ... server.js(含其参数)换成二进制路径,其余保持不变 (NG_DATA_FILE等 env、respawn、procd 的 env 文件引用都不要动):procd_set_param command /opt/nexusgate/nexusgate-panel若原服务通过
/etc/nexusgate.env注入环境变量,Go 版读的是同名 变量(NG_DATA_FILE、NG_HOST、NG_PORT、NG_COOKIE_SECURE、 NG_ADMIN_USERNAME、NG_ADMIN_PASSWORD),无需改动。 -
重启并验证(只用 init 脚本,不要手动起进程):
/etc/init.d/nexusgate restart curl http://127.0.0.1:8787/healthz再开面板确认:登录、概览计数、节点列表、任务队列、订阅链接各看一眼。
-
可选:
NG_PUBLIC_DIR=/opt/nexusgate/public可让面板改从磁盘目录 读前端(调试前端时免重编);不设则用二进制内嵌的前端。
回滚
把 /etc/init.d/nexusgate 的启动命令改回原来的 node ... server.js,
/etc/init.d/nexusgate restart 即可。数据文件未做任何格式变更,
Node 版直接读 Go 版写过的库(已在差分测试中双向验证)。
备注
- 内存参考(沙箱实测、同一种子库):Go 版空闲 VmRSS 约 10.5MB, 一轮登录+列表请求后约 30MB(Go 堆保留口径);Node 版空闲约 66MB (生产路由器实测约 54MB)。
- 二进制本体不含 data/,更新面板不会触碰数据库;更新前仍建议在 面板设置页下载一份 JSON 备份。
- agent 侧(各节点机)与本次切换无关,仍用现有 Go agent。