Per user decision 2026-10-21 (reverses the earlier keep call in PANEL-LITE-SPEC.md, now amended): the lite panel never runs a local core, so measuring/probing from the panel host is meaningless. Backend: - delete service/outbound probe implementation (probe_http.go and its tests) and the TestOutbound/TestOutbounds batch prober; outbound traffic accounting (AddTraffic/GetOutboundsTraffic/Reset) unchanged - drop POST /panel/api/xray/testOutbound + testOutbounds routes and the outboundTestUrl setting (get/update plumbing removed; stored rows in existing DBs are inert) - drop POST /panel/api/server/restartXrayService + stopXrayService routes/handlers and the node-sync allowlist entry; the service-level Stop/RestartXrayService stay for internal import/restore flows - node-sync allowlist contract test updated to the new inventory Frontend: - remove test buttons/mode switch/test-all from outbounds tab, card list and table columns; delete TestResultPopover and CountryPill; drop the egress/country/latency columns fed by probe results - remove outboundTestUrl state and save plumbing from useXraySetting and the Basics tab field; drop OutboundTestResult schemas - delete the 15 now-dead i18n keys from all 13 locales (incl. the restart/stop keys orphaned since P6/P7 — i18n-dead-keys test green) - tests: drop the test-URL hook test, re-probe the loopback index mapping through Move-to-top, regenerate API types (gen)
3x-ui-agent
基于上游 3x-ui v3.7.0 的二次开发 fork:节点 agent 化。节点鸡不再跑完整面板,只跑一个轻量 agent(约 60MB 内存),由主控统一管理、下发 xray 配置。
本仓库托管在自建 Gitea:https://git.881218.xyz/rogue/3x-ui-agent,二进制从本仓库的 Releases 下载。不要使用上游的一键安装脚本/命令(install.sh、update.sh 等仍指向原版,会装成上游原版,与本 fork 不兼容)。
架构
- 主控:完整 3x-ui 面板,唯一的配置可信源。管理节点、入站、客户端,下发完整 xray 配置(含出站、路由)到各 agent。
- Agent:跑在节点鸡上,通过注册 token 向主控注册。定时拉取主控下发的 xray 配置并应用,上报心跳和流量。节点下发仅支持 VLESS / SS2022 两类入站(本 fork 的取向)。
同一个二进制、两种角色:不带参数运行是主控面板,x-ui agent --config /etc/x-ui/agent.json 运行是 agent。
安装
二进制下载:本仓库 Releases,按架构选 x-ui-linux-amd64 或 x-ui-linux-arm64。
仓库根目录的
install-master.sh/install-agent.sh是一键脚本,下载源已迁至本仓 Gitea Releases(tagv3.7.0-agent.1),可直接使用;也可按下面步骤手动部署。
主控
mkdir -p /usr/local/x-ui/bin /etc/x-ui
# 1. 放主控二进制(Releases 下载的 x-ui-linux-<架构>)
cp x-ui-linux-amd64 /usr/local/x-ui/x-ui && chmod +x /usr/local/x-ui/x-ui
# 2. 放 xray 二进制与 geo 文件到 bin/ 子目录
# 纯控制面部署(节点全走 agent)可禁用本机 xray:不放,或放了之后 chmod -x
cp xray-linux-amd64 /usr/local/x-ui/bin/
cp geoip.dat geosite.dat /usr/local/x-ui/bin/
启动(二选一):
- Debian/Ubuntu(systemd):把仓库的
x-ui.service.debian复制为/etc/systemd/system/x-ui.service,然后systemctl daemon-reload && systemctl enable --now x-ui。 - OpenWrt(procd):用 init 脚本以
/usr/local/x-ui/x-ui为命令启动,工作目录/usr/local/x-ui。
数据库在 /etc/x-ui/x-ui.db。面板端口按设置,默认 2053,首次登录默认账号 admin / admin,请登录后立即修改。
Agent(节点鸡)
先在主控侧为该节点生成注册 token(建节点 → 用面板 API Token 签发绑定该节点的 agent token,完整步骤见 docs/AGENT.md),然后在节点鸡上:
mkdir -p /usr/local/x-ui/bin /etc/x-ui
# 1. 放同一个 x-ui 二进制(与主控同版本)
cp x-ui-linux-amd64 /usr/local/x-ui/x-ui && chmod +x /usr/local/x-ui/x-ui
# 2. 放 xray 二进制与 geo 文件(agent 不负责下载,需手动放置)
cp xray-linux-amd64 /usr/local/x-ui/bin/xray && chmod +x /usr/local/x-ui/bin/xray
cp geoip.dat geosite.dat /usr/local/x-ui/bin/
# 3. 写 agent 配置
cat > /etc/x-ui/agent.json <<'EOF'
{
"master_url": "http://主控地址:2053",
"token": "<主控签发的注册 token>",
"node_name": "节点名"
}
EOF
chmod 600 /etc/x-ui/agent.json
master_url走内网用http://;走https://需可信证书(自签连不上)。- agent 另有独立的运行时配置
config-agent.json(生成于bin/);agent.json可选api_port指定 xray stats API 端口(部署口径 62790,metrics 端口为其下一位 62791)。 - 启动:Debian 把仓库的
systemd/x-ui-agent.service复制到/etc/systemd/system/后systemctl enable --now x-ui-agent;OpenRC 用仓库的openrc/x-ui-agent放到/etc/init.d/x-ui-agent。
agent 约 30 秒后拉到配置并启动 xray,节点在面板显示在线。更细的 agent 说明(出站/路由下发、验证、故障排查)见 docs/AGENT.md。
卸载
主控
# 先停服务:systemctl disable --now x-ui(或 /etc/init.d/x-ui stop)
rm -f /etc/systemd/system/x-ui.service # 或删掉对应的 procd init 脚本
rm -rf /usr/local/x-ui /etc/x-ui
Agent
# 先停服务:systemctl disable --now x-ui-agent(或 rc-service x-ui-agent stop)
rm -f /etc/systemd/system/x-ui-agent.service # 或 /etc/init.d/x-ui-agent
rm -rf /usr/local/x-ui /etc/x-ui
(/etc/x-ui 里含数据库与 token 配置,确认不再需要再删。)
使用流程
- 主控侧建节点并签发 agent 注册 token(见 docs/AGENT.md)
- 节点鸡按上面步骤部署 agent,填入主控地址和 token
- 在「入站列表」创建入站(VLESS / SS2022),「部署到」选择在线的 agent 节点
- 主控自动把完整 xray 配置下发到节点,客户端即可连接
内存占用(实测)
| 内存 | |
|---|---|
| agent + xray | 约 63MB |
| 完整 3x-ui 面板 | 130–160MB |
另有路由器主控精简版构建(剥离 xray-core 库,见仓库内 PANEL-LITE-SPEC.md),面向纯控制面部署,内存显著更低。
与原版的区别
- 节点不再需要安装完整面板
- 主控是唯一可信源,节点配置全部由主控下发
- 节点在线状态由 agent 心跳维持
- 添加节点支持 Agent 类型,使用注册 token 接入
License
GPL-3.0(继承上游 3x-ui)