Muse e310abcba0
CI / go-test (push) Waiting to run
CI / postgres-durable-first (push) Waiting to run
CI / codegen (push) Waiting to run
CI / govulncheck (push) Waiting to run
CI / race (push) Waiting to run
CI / fuzz-smoke (push) Waiting to run
CI / golangci (push) Waiting to run
CI / frontend (push) Waiting to run
Release 3X-UI / build (386) (push) Waiting to run
Release 3X-UI / build (amd64) (push) Waiting to run
Release 3X-UI / build (arm64) (push) Waiting to run
Release 3X-UI / build (armv5) (push) Waiting to run
Release 3X-UI / build (armv6) (push) Waiting to run
Release 3X-UI / build (armv7) (push) Waiting to run
Release 3X-UI / build (s390x) (push) Waiting to run
Release 3X-UI / Build for Windows (amd64) (push) Waiting to run
Release 3X-UI / Publish rolling dev release (push) Blocked by required conditions
CodeQL Advanced / Analyze (go) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
merge next-scripts: items 15/16/17/23 (install-agent mirror/reuse/self-check, openrc respawn)
2026-10-22 21:51:51 +08:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00
2026-08-24 15:07:15 +02:00

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(tag v3.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. 放同一个二进制(与主控同版本),在节点上改名为 xui-agent(与主控进程区分、避免同机覆盖)
cp x-ui-linux-amd64 /usr/local/x-ui/xui-agent && chmod +x /usr/local/x-ui/xui-agent

# 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 配置,确认不再需要再删。)

使用流程

  1. 主控侧建节点并签发 agent 注册 token(见 docs/AGENT.md)
  2. 节点鸡按上面步骤部署 agent,填入主控地址和 token
  3. 在「入站列表」创建入站(VLESS / SS2022),「部署到」选择在线的 agent 节点
  4. 主控自动把完整 xray 配置下发到节点,客户端即可连接

内存占用(实测)

内存
agent + xray 约 63MB
完整 3x-ui 面板 130–160MB

另有路由器主控精简版构建(剥离 xray-core 库,见仓库内 PANEL-LITE-SPEC.md),面向纯控制面部署,内存显著更低。

与原版的区别

  • 节点不再需要安装完整面板
  • 主控是唯一可信源,节点配置全部由主控下发
  • 节点在线状态由 agent 心跳维持
  • 添加节点支持 Agent 类型,使用注册 token 接入

License

GPL-3.0(继承上游 3x-ui)

S
Description
No description provided
Readme GPL-3.0
93 MiB
L-UI V1.0.1
Latest
2026-10-23 00:44:16 +08:00
Languages
Go 59.9%
TypeScript 36.1%
Shell 2.4%
CSS 1.2%
JavaScript 0.3%