简报·YT
← 返回 GitHub 动态
MHSanaei/3x-ui · ⭐ 已Star 已完成

MHSanaei/3x-ui v3.10.0

2026-10-12 14:44 · ⭐ 4.8万 · GitHub Release 原文 ↗
#协议扩展 #节点同步 #安全加固

MHSanaei/3x-ui v3.10.0

本次版本引入 MASQUE 与 XDRIVE 两种全新协议/传输、升级到 Xray-core v26.10.10(带来 Lua DNS/路由脚本与新 TUN 选项),同时大规模修复节点同步逻辑、对 panel 的 systemd 服务做沙箱加固,并把会让 Xray 启动失败的非法配置改为保存时直接拒绝。

新增能力

修复与改进

Breaking Change / 升级前必须处理

▸ Release Notes 英文原文(16313 字符)
## 🚀 MASQUE, XDRIVE, Xray-core v26.10.10 & Node Sync - 🛰️ **MASQUE** — a new protocol and transport for inbounds and outbounds, and the WARP modal can now register WARP over MASQUE. - ☁️ **XDRIVE transport** — tunnel traffic through files in Google Drive, a local folder or any templated HTTP storage API. - ⚙️ **Xray-core v26.10.10** — Lua DNS and routing scripts, new TUN and finalmask options, and stored configs migrate to the new shapes on their own. - 🔗 **Node sync** — master pushes reach every node, a reset node can no longer wipe the hub's clients, and client edits on node inbounds no longer drop connections. - 🧱 **Configs that would stop Xray are refused** — Shadowsocks-2022 keys and ciphers, mask passwords and storage settings Xray cannot run are rejected when you save. - 📡 **Port hopping restored** — Hysteria and XHTTP clients hop ports again through the `udphop` mask. - 🛡️ **Sandboxed systemd service** — the panel now runs with a reduced capability set and read-only system directories. - 🔄 **Safer updates** — the database migration finishes before the service starts, and an update no longer touches your TLS setup. - 🐘 **PostgreSQL 18** — new local database installs get the current major version from the official PGDG repository. --- ## ⚠️ Before you upgrade ### Action required - Several node fixes run on the node itself: in-place client updates (no dropped connections), applying master pushes on admin-token nodes, and hosting MASQUE inbounds. A node on an older release keeps the old behavior, and placing a MASQUE inbound on it is refused — **do this:** upgrade every node, not only the master. - Xray-core v26.10.10 checks outbound TLS against its bundled Mozilla roots instead of the OS certificate store — **do this:** on any outbound to a server signed by a privately installed CA, turn on *Use system CA* in that outbound's TLS settings. - JSON subscriptions now send port hopping as the `udphop` mask (needs Xray-core 26.9.9+) and xdns masks in the `names`/`addrs` shape (needs Xray-core 26.10.10+) — **do this:** ask users of port hopping or xdns to update their client apps to a build on Xray-core 26.10.10 or newer. - On systemd installs the service is now sandboxed: `/usr`, `/boot`, `/etc`, `/home` and `/root` are read-only except the panel's own DB, bin and log folders — **do this:** if the panel or Xray must write anywhere else under those trees, add the path with `ReadWritePaths=` in your own drop-in (`/etc/systemd/system/x-ui.service.d/20-local.conf`). After you change an `XUI_*_FOLDER` value in `/etc/default/x-ui`, re-run the update so the generated drop-in picks it up. ### Automatic — no action needed - At first start, stored xdns finalmasks are rewritten to `names`/`addrs`. Legacy `quicParams.udpHop` on client-side configs (hosts, the subscription's global finalmask, cached outbound subscriptions, template outbounds) becomes a `udphop` mask. Inbounds keep `udpHop` as the advertised port range. Each rewrite runs once, and a failure stops the panel from starting. - Shadowsocks-2022 inbounds on `2022-blake3-chacha20-poly1305` move to `2022-blake3-aes-256-gcm`, and their 32-byte keys stay valid. Server keys of the wrong size for their method are replaced. Neither kind of inbound could start before. A failure stops the panel from starting. - `install.sh` and `update.sh` install the hardened unit and regenerate `x-ui.service.d/10-xui-sandbox.conf` from your `XUI_*` folders on every run. The seccomp filter is added only on systemd 239 or newer, and on older systemd the scripts list the protections it lacks. A folder path containing whitespace is left out with a warning, and a failed refresh is only a warning. - A stored report or LDAP sync schedule that no longer parses falls back to the job's default, with a warning in the log. - PostgreSQL 18 applies only to new local databases. An existing cluster is never upgraded. ### Requirements Go 1.27.2 · Xray-core v26.10.10 --- ### 🔐 Security - The shipped systemd units now sandbox the panel. Only its own folders are writable, its capabilities are reduced, namespaces and address families are restricted, `UMask=0077` is set, and a `@system-service` seccomp filter is added on systemd 239 or newer ([#6718](https://github.com/MHSanaei/3x-ui/pull/6718)) @ChesterFishmansWork - The repository's automated PR-review and issue-analysis workflows no longer hold write or OIDC tokens, so code checked out from a pull request cannot mint a write token ([`9130f6dd`](https://github.com/MHSanaei/3x-ui/commit/9130f6dd), [`5939fda3`](https://github.com/MHSanaei/3x-ui/commit/5939fda3), [`53239285`](https://github.com/MHSanaei/3x-ui/commit/53239285)) ### 🆕 New - MASQUE inbounds and outbounds: CONNECT-IP over HTTP/3 or HTTP/2, always behind TLS. Clients sign in with their email and password, and the JSON subscription builds each client's MASQUE outbound. Share links and Clash skip MASQUE because it has no link format ([`b04039c2`](https://github.com/MHSanaei/3x-ui/commit/b04039c2), [`00aaef38`](https://github.com/MHSanaei/3x-ui/commit/00aaef38), [`c4b9b3f9`](https://github.com/MHSanaei/3x-ui/commit/c4b9b3f9)) - The WARP modal can register a WARP device over MASQUE and turn it into a ready `warp-masque` outbound. Your existing WireGuard registration is left untouched ([`04cccef3`](https://github.com/MHSanaei/3x-ui/commit/04cccef3)) - XDRIVE transport on inbounds and outbounds: tunnel a stream through files in Google Drive, a local folder or an HTTP storage API described by a template. XDRIVE outbounds can use TLS to front the storage API, and storage settings Xray cannot open are refused when you save ([`ca598359`](https://github.com/MHSanaei/3x-ui/commit/ca598359), [`c7d89cea`](https://github.com/MHSanaei/3x-ui/commit/c7d89cea), [`c5e1e54c`](https://github.com/MHSanaei/3x-ui/commit/c5e1e54c)) - Lua DNS and routing scripts: DNS gets a script field and a per-server ID, Basics gets a routing script field, and the Routing tab warns that rules are skipped while a script is set ([`b6c859f5`](https://github.com/MHSanaei/3x-ui/commit/b6c859f5), [`73a028f5`](https://github.com/MHSanaei/3x-ui/commit/73a028f5)) - TUN inbounds can set the Windows adapter type, point systemd-resolved at the TUN gateway on Linux, and block DNS leaks through WFP on Windows ([`ef4bda4e`](https://github.com/MHSanaei/3x-ui/commit/ef4bda4e)) - The finalmask editor now covers more of the format: header-custom variables and transforms, a TCP `errors` group, UDP prefix/standalone mode, the sudoku UDP mask, and noise reset ranges such as `60-120`. These keys used to be dropped on save ([`1c050f87`](https://github.com/MHSanaei/3x-ui/commit/1c050f87)) - Outbound TLS has a *Use system CA* switch for servers signed by a privately installed CA ([`73a028f5`](https://github.com/MHSanaei/3x-ui/commit/73a028f5)) - New local PostgreSQL installs get PostgreSQL 18 from the official PGDG repository. Where PGDG has no build, the distro package is used instead ([`c9207b6f`](https://github.com/MHSanaei/3x-ui/commit/c9207b6f)) ### ⚡ Improved - Xray-core updated to v26.10.10 ([`73a028f5`](https://github.com/MHSanaei/3x-ui/commit/73a028f5)) - Go 1.27.2 and refreshed Go dependencies, including fasthttp 1.75.0 ([`82c77111`](https://github.com/MHSanaei/3x-ui/commit/82c77111), [#6767](https://github.com/MHSanaei/3x-ui/pull/6767)) - Frontend and docs dependencies refreshed, and the npm audit findings cleared ([`d57dcf82`](https://github.com/MHSanaei/3x-ui/commit/d57dcf82), [`2e8af647`](https://github.com/MHSanaei/3x-ui/commit/2e8af647)) - The public subscription page uses the panel's own theme in light, dark and ultra-dark ([`fd6c5925`](https://github.com/MHSanaei/3x-ui/commit/fd6c5925)) - Traffic formatting does less work and allocates less memory when building status and report output ([#6790](https://github.com/MHSanaei/3x-ui/pull/6790)) @javi0guerrero4-cloud - CI now tests node sync end to end with a real master panel and a real node panel, for both admin-token and node-sync-token enrollment ([`f843fe55`](https://github.com/MHSanaei/3x-ui/commit/f843fe55), [`dae91276`](https://github.com/MHSanaei/3x-ui/commit/dae91276)) - Fixed a data race in the service test suite, caused by a public-IP lookup that kept running after its test ended ([#6742](https://github.com/MHSanaei/3x-ui/pull/6742)) @AyaseEli-Bing - SECURITY.md now names an email contact for reporters without a GitHub account, and the repository publishes a threat model ([`8fe7be94`](https://github.com/MHSanaei/3x-ui/commit/8fe7be94), [`eb498a3c`](https://github.com/MHSanaei/3x-ui/commit/eb498a3c)) ### 🐞 Fixed **Nodes** - Clients attached, disabled or edited on the master now reach nodes enrolled with an admin token. An inbound deleted on the node is re-created by reconcile, which used to keep trying to update it ([`2ffc694a`](https://github.com/MHSanaei/3x-ui/commit/2ffc694a)) - A node that reports an empty client list (just reset, restarted or removed) no longer causes the hub to delete those clients. The hub pushes them back to the node ([#6734](https://github.com/MHSanaei/3x-ui/pull/6734)) @yukh975 - Renewing, resetting or auto-disabling a client on a node inbound now updates its users in place, so open connections on that port stay up. The inbound used to be rebuilt ([`44083338`](https://github.com/MHSanaei/3x-ui/commit/44083338)) - Masters enrolled with a node-sync token or mTLS can again set the subscription sort order, bulk-reset client traffic and read active inbounds on their nodes. These requests used to fail with 403 ([`5819a01c`](https://github.com/MHSanaei/3x-ui/commit/5819a01c)) - A client detached from a node inbound is no longer disabled on the master by the node's stale stats, and its old quota is no longer written back ([`dd956947`](https://github.com/MHSanaei/3x-ui/commit/dd956947)) - Client traffic history and quota usage survive when a node inbound is replaced under a new tag ([`6be3c438`](https://github.com/MHSanaei/3x-ui/commit/6be3c438)) **Xray config & inbounds** - Shadowsocks-2022 inbounds no longer offer `2022-blake3-chacha20-poly1305`, which Xray cannot run with multiple users. Stored inbounds move to `2022-blake3-aes-256-gcm` ([`f1ed1a9b`](https://github.com/MHSanaei/3x-ui/commit/f1ed1a9b), [`c20082d2`](https://github.com/MHSanaei/3x-ui/commit/c20082d2)) - A Shadowsocks-2022 server key of the wrong size for its method is refused when you save. It used to stop Xray ([`b9e1d3af`](https://github.com/MHSanaei/3x-ui/commit/b9e1d3af)) - A salamander or gecko finalmask password shorter than 4 bytes is refused when you save and flagged in the editor. It used to stop Xray when the listener opened ([`0466e8b0`](https://github.com/MHSanaei/3x-ui/commit/0466e8b0)) - VLESS clients keep connecting after their inbound moves to a transport that cannot carry Vision. The Vision flow is now applied only where Xray runs it: TLS or REALITY on raw TCP, or VLESS encryption on any transport ([`c5e1e54c`](https://github.com/MHSanaei/3x-ui/commit/c5e1e54c)) - Balancer overrides set from the panel survive routing reloads and node tests. An override that points at an unknown or removed outbound is refused or cleared ([#6779](https://github.com/MHSanaei/3x-ui/pull/6779)) @AliKarami - TLS ALPN defaults to `http/1.1` for the WebSocket transport, so the WebSocket handshake no longer fails when h2 is negotiated ([#6787](https://github.com/MHSanaei/3x-ui/pull/6787)) @HappyLeslieAlexander - Port hopping works again for Hysteria and XHTTP (HTTP/3) outbounds and for JSON-subscription clients. The hop is written as the client `udphop` mask, kept on every endpoint, and placed last, where Xray requires it ([`ec0a57fc`](https://github.com/MHSanaei/3x-ui/commit/ec0a57fc), [`27e45f30`](https://github.com/MHSanaei/3x-ui/commit/27e45f30), [`6321297f`](https://github.com/MHSanaei/3x-ui/commit/6321297f)) **Subscriptions & links** - JSON subscriptions emit `"encryption": "none"` for VLESS inbounds stored without that key. They used to emit an empty value, which Xray refuses to load ([#6781](https://github.com/MHSanaei/3x-ui/pull/6781)) @jayhemnani9910 - A host's ECH config, certificate pins and verify name now reach clients in the JSON subscription ([`66ef5bbc`](https://github.com/MHSanaei/3x-ui/commit/66ef5bbc)) - Hysteria share links now include the host's server description, as VLESS, Trojan and Shadowsocks links already did ([#6740](https://github.com/MHSanaei/3x-ui/pull/6740)) @AyaseEli-Bing - QR codes are shown again for REALITY links and for VLESS-encryption links authenticated by an X25519 key. Only links that carry post-quantum keys too large to scan hide the QR code ([`d7da64f2`](https://github.com/MHSanaei/3x-ui/commit/d7da64f2)) **TUIC, WireGuard & AmneziaWG** - TUIC sniffing keeps the IP destination the client asked for ([#6753](https://github.com/MHSanaei/3x-ui/pull/6753)) @libmur-dev - TUIC clients show their live speed again, and the certificate buttons are laid out correctly ([#6723](https://github.com/MHSanaei/3x-ui/pull/6723)) @poise52 - AmneziaWG UDP replies larger than the tunnel MTU are now fragmented to fit it ([#6780](https://github.com/MHSanaei/3x-ui/pull/6780)) @mrdarkerr - A client on both a WireGuard and an AmneziaWG inbound now gets its own WireGuard public key and keepalive on the WireGuard peer ([#6751](https://github.com/MHSanaei/3x-ui/pull/6751)) @mvanhorn **Panel & settings** - On PostgreSQL, the panel no longer hangs until restart when node traffic sync runs at the same time as subscription fetches ([`b5a04ea9`](https://github.com/MHSanaei/3x-ui/commit/b5a04ea9)) - Report and LDAP sync schedules accept a standard five-field crontab. A schedule that cannot be parsed is refused when you save, so the job no longer silently never runs ([`b124af2a`](https://github.com/MHSanaei/3x-ui/commit/b124af2a)) - The attach and detach clients modals list the clients the first time they open ([#6736](https://github.com/MHSanaei/3x-ui/pull/6736)) @drakeo338 - The renewal preview shows readable dates with their UTC offset and labels its renewal count as an estimate, and the renewal form layout and mode help are clearer ([#6662](https://github.com/MHSanaei/3x-ui/pull/6662), [#6672](https://github.com/MHSanaei/3x-ui/pull/6672)) @JacktheRanger - The panel-update confirmation closes as soon as you confirm, so it no longer dims the progress indicator ([#6766](https://github.com/MHSanaei/3x-ui/pull/6766)) @libmur-dev - Toast messages follow the dark and ultra-dark themes ([`d1b60799`](https://github.com/MHSanaei/3x-ui/commit/d1b60799)) - Action buttons in the overview modals wrap to a new line instead of spilling out with longer translations ([`49fbcdc0`](https://github.com/MHSanaei/3x-ui/commit/49fbcdc0)) **Install & update** - An update now runs the database migration before starting the service. An upgrade that adds schema no longer stops the service with "duplicate column" ([#6729](https://github.com/MHSanaei/3x-ui/pull/6729)) @mrnickson-hue - Updating from the panel no longer opens the SSL menu. It used to stop x-ui to issue an IP certificate, could delete `/root/cert/ip` and the acme.sh state, or loop forever on an IP prompt. The URL printed afterwards shows the scheme the panel actually serves ([`257559c3`](https://github.com/MHSanaei/3x-ui/commit/257559c3)) --- ### Reports ![Total Download](https://img.shields.io/github/downloads/mhsanaei/3x-ui/v3.10.0/total?label=Total-Download&color=success) ### New Contributors * @drakeo338 made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6736 * @AyaseEli-Bing made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6740 * @AliKarami made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6779 * @mrdarkerr made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6780 * @jayhemnani9910 made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6781 * @HappyLeslieAlexander made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6787 * @javi0guerrero4-cloud made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6790 **Full Changelog**: https://github.com/MHSanaei/3x-ui/compare/v3.9.0...v3.10.0
▸ 主项目介绍 · MHSanaei/3x-ui
▸ README 原文(同步于 2026-09-13 16:24)
[English](/README.md) | [فارسی](/README.fa_IR.md) | [العربية](/README.ar_EG.md) | [中文](/README.zh_CN.md) | [Español](/README.es_ES.md) | [Русский](/README.ru_RU.md) | [Türkçe](/README.tr_TR.md) <p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="./media/3x-ui-dark.png"> <img alt="3x-ui" src="./media/3x-ui-light.png"> </picture> </p> <p align="center"> <a href="https://github.com/MHSanaei/3x-ui/releases"><img src="https://img.shields.io/github/v/release/mhsanaei/3x-ui" alt="Release"></a> <a href="https://github.com/MHSanaei/3x-ui/actions"><img src="https://img.shields.io/github/actions/workflow/status/mhsanaei/3x-ui/release.yml.svg" alt="Build"></a> <a href="#"><img src="https://img.shields.io/github/go-mod/go-version/mhsanaei/3x-ui.svg" alt="GO Version"></a> <a href="https://github.com/MHSanaei/3x-ui/releases/latest"><img src="https://img.shields.io/github/downloads/mhsanaei/3x-ui/total.svg" alt="Downloads"></a> <a href="https://www.gnu.org/licenses/gpl-3.0.en.html"><img src="https://img.shields.io/badge/license-GPL%20V3-blue.svg?longCache=true" alt="License"></a> <a href="https://pkg.go.dev/github.com/mhsanaei/3x-ui/v3"><img src="https://pkg.go.dev/badge/github.com/mhsanaei/3x-ui/v3.svg" alt="Go Reference"></a> <a href="https://docs.sanaei.dev"><img src="https://img.shields.io/badge/docs-docs.sanaei.dev-22d3ee" alt="Documentation"></a> </p> **3X-UI** 是一个先进的开源 Web 控制面板,用于管理 [Xray-core](https://github.com/XTLS/Xray-core) 服务器。它提供简洁、多语言的界面,用于部署、配置和监控各种代理与 VPN 协议——从单台 VPS 到多节点部署。 3X-UI 作为原始 X-UI 项目的增强分支(fork),增加了更广泛的协议支持、更好的稳定性、按客户端的流量统计以及许多提升使用体验的功能。 > [!IMPORTANT] > 本项目仅供个人使用。请勿将其用于非法目的,也请勿在生产环境中使用。 ## 功能特性 - **多协议入站** — VLESS、VMess、Trojan、Shadowsocks、WireGuard、AmneziaWG、Hysteria2、MTProto、HTTP、SOCKS (Mixed)、Dokodemo-door / Tunnel 和 TUN。 - **现代传输与安全** — TCP (Raw)、mKCP、WebSocket、gRPC、HTTPUpgrade 和 XHTTP,并通过 TLS、XTLS 和 REALITY 加密。 - **内置 AmneziaWG** — 抗 DPI 的 WireGuard 直接在面板内的用户态网络栈上运行,无需内核模块、DKMS 或额外软件包。 - **MTProto 代理** — 按客户端配置 FakeTLS 密钥、广告标签和配额,实时生效且不会断开已有连接。 - **回落 (Fallback)** — 通过 Xray 的 fallback 功能在单个端口上提供多种协议(例如在 443 端口上同时使用 VLESS 和 Trojan)。 - **按客户端管理** — 流量配额、到期日期、可豁免受信任地址的 IP 限制、HWID 设备数限制、定时续期周期、实时在线状态,以及一键分享链接、二维码和订阅。 - **流量统计** — 按入站、按客户端、按出站统计,并支持重置控制。 - **多节点支持** — 从单一面板管理并扩展到多台服务器,并可将入站克隆到其他节点。 - **出站与路由** — WARP、NordVPN、PIA、自定义路由规则、支持均衡器间回退的负载均衡器,以及出站代理链。内置的 geosite 与 geoip 分类可直接在规则编辑器中浏览。 - **内置订阅服务器** — 提供 raw、JSON 和 Clash 输出,可依据客户端 User-Agent 自动选择,并支持[自定义页面模板](docs/custom-subscription-templates.md)。 - **Telegram 机器人**,用于远程监控和管理。 - **RESTful API**,支持带作用域、可设置有效期的令牌,并提供面板内置的 API 参考文档。 - **可安装面板 (PWA)** — 将 3X-UI 固定到桌面或手机主屏幕。 - **灵活的存储** — SQLite(默认)或 PostgreSQL。 - **13 种界面语言**,支持深色和浅色主题。 - **Fail2ban 集成**,用于强制执行按客户端的 IP 限制。 ## 截图 <details> <summary>点击展开</summary> <picture> <source media="(prefers-color-scheme: dark)" srcset="./media/01-overview-dark.png"> <img alt="Overview" src="./media/01-overview-light.png"> </picture> <picture> <source media="(prefers-color-scheme: dark)" srcset="./media/02-add-inbound-dark.png"> <img alt="Inbounds" src="./media/02-add-inbound-light.png"> </picture> <picture> <source media="(prefers-color-scheme: dark)" srcset="./media/03-add-client-dark.png"> <img alt="Add client" src="./media/03-add-client-light.png"> </picture> <picture> <source media="(prefers-color-scheme: dark)" srcset="./media/05-add-nodes-dark.png"> <img alt="Configs" src="./media/05-add-nodes-light.png"> </picture> </details> ## 快速开始 ```bash bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh) ``` 若要安装特定版本,请在命令后附加对应的标签(例如 `v3.7.0`): ```bash bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh) v3.7.0 ``` 若要安装滚动更新的 **dev** 版本(来自 `main` 的最新逐次提交预发布版本,而非稳定版本),请传入 `dev-latest`: ```bash bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh) dev-latest ``` 安装过程中会生成随机的用户名、密码和访问路径。安装完成后,运行 `x-ui` 打开管理菜单,您可以在其中启动/停止服务、查看或重置登录凭据、管理 SSL 证书等。 每个发布资源都会在其旁边附带一个 `.sha256` 校验和。`install.sh` 和更新程序都会据此校验压缩包,不匹配时中止。 完整文档(安装、配置、运维以及完整的 API 参考)请访问 **[docs.sanaei.dev](https://docs.sanaei.dev/zh)**。 ### 无人值守安装 安装程序也可以**非交互式**运行,适用于 cloud-init。 设置 `XUI_NONINTERACTIVE=1`(或在无 TTY 的情况下通过管道传入),它就会全程 零提示地完成端到端安装,生成随机凭据并写入 `/etc/x-ui/install-result.env`。请参阅 [`deploy/`](deploy/): - [Cloud-init user-data](deploy/cloud-init/) — 在任意云平台上无人值守安装(Hetzner/AWS/DO/Vultr/GCP/Azure/Oracle) - [Hetzner Cloud 说明](deploy/marketplace/hetzner/) — 在 Hetzner 上基于 cloud-init 的部署 ## 支持的平台 **操作系统:** Ubuntu、Debian、Armbian、Fedora、CentOS、RHEL、AlmaLinux、Rocky Linux、Oracle Linux、Amazon Linux、Virtuozzo、Arch、Manjaro、Parch、openSUSE (Tumbleweed / Leap)、Alpine 和 Windows。 **架构:** `amd64` · `386` · `arm64` (aarch64) · `armv7` · `armv6` · `armv5` · `s390x`。 ## 数据库选项 3X-UI 支持两种后端,可在安装时选择: - **SQLite**(默认)— 位于 `/etc/x-ui/x-ui.db` 的单个文件。无需配置,适合中小型部署。 - **PostgreSQL** — 推荐用于大量客户端或多节点设置。安装程序可以为您在本地安装 PostgreSQL,或接受指向现有服务器的 DSN。 运行时通过环境变量选择后端(安装程序会为您写入 `/etc/default/x-ui`): ``` XUI_DB_TYPE=postgres XUI_DB_DSN=postgres://xui:password@127.0.0.1:5432/xui?sslmode=disable ``` ### 将现有的 SQLite 安装迁移到 PostgreSQL ```bash x-ui migrate-db --dsn "postgres://xui:password@127.0.0.1:5432/xui?sslmode=disable" # 然后在 /etc/default/x-ui 中设置 XUI_DB_TYPE 和 XUI_DB_DSN 并重启: systemctl restart x-ui ``` 源 SQLite 文件保持不变;在确认新后端正常工作后,请手动删除它。 ### Docker 默认的 `docker compose up -d` 仍使用 SQLite。若要使用捆绑的 PostgreSQL 服务运行,请取消注释 `docker-compose.yml` 中的两行 `XUI_DB_*` 环境变量,并使用该 profile 启动: ```bash docker compose --profile postgres up -d ``` 该镜像捆绑了 Fail2ban(默认启用),用于强制执行按客户端的 **IP 限制**。Fail2ban 使用 `iptables` 封禁违规者,这需要 `NET_ADMIN` 权限。`docker-compose.yml` 已通过 `cap_add` 授予该权限;如果您改用 `docker run` 启动容器,请自行添加这些权限,否则封禁只会被记录而永远不会生效: ```bash docker run -d --cap-add=NET_ADMIN --cap-add=NET_RAW ... ghcr.io/mhsanaei/3x-ui ``` ## 环境变量 | 变量 | 说明 | 默认值 | | --- | --- | --- | | `XUI_DB_TYPE` | 数据库后端:`sqlite` 或 `postgres` | `sqlite` | | `XUI_DB_DSN` | PostgreSQL 连接字符串(当 `XUI_DB_TYPE=postgres` 时) | — | | `XUI_DB_FOLDER` | SQLite 数据库文件所在目录 | `/etc/x-ui` | | `XUI_DB_MAX_OPEN_CONNS` | 最大打开连接数(PostgreSQL 连接池) | — | | `XUI_DB_MAX_IDLE_CONNS` | 最大空闲连接数(PostgreSQL 连接池) | — | | `XUI_INIT_WEB_BASE_PATH` | Web 面板的初始 URI 路径 | `/` | | `XUI_ENABLE_FAIL2BAN` | 启用基于 Fail2ban 的 IP 限制 | `true` | | `XUI_LOG_LEVEL` | 日志级别(`debug`、`info`、`warning`、`error`) | `info` | | `XUI_DEBUG` | 启用调试模式 | `false` | | `XUI_TUNNEL_HEALTH_MONITOR` | 启用隧道健康监控(探测某个 URL,在连续多次失败后重启 xray;重启会断开所有客户端) | `false` | | `XUI_TUNNEL_HEALTH_PROXY` | 探测请求所经过的代理;将其指向本地 xray 入站,使探测能够测试隧道(例如 `socks5://127.0.0.1:1080`)。留空表示探测仅检查主机连通性 | — | | `XUI_TUNNEL_HEALTH_URL` | 用于检测隧道健康状况的探测 URL | `https://www.cloudflare.com/cdn-cgi/trace` | | `XUI_TUNNEL_HEALTH_INTERVAL` | 两次探测之间的间隔 | `30s` | | `XUI_TUNNEL_HEALTH_TIMEOUT` | 单次探测的超时时间 | `10s` | | `XUI_TUNNEL_HEALTH_FAILURES` | 触发重启前的连续失败次数 | `3` | | `XUI_TUNNEL_HEALTH_COOLDOWN` | 两次连续重启之间的最小间隔 | `5m` | | `NODE_TOKEN_ENCRYPTION` | 节点 API 令牌的静态加密:`off`、`migration` 或 `required`(注意:无 `XUI_` 前缀) | `off` | | `XUI_NODE_TOKEN_KEY_FILE` | JSON 密钥环(权限 `0600`),包含活动密钥 ID 及其 base64 编码的 32 字节密钥 | `/etc/x-ui/node_token_key.json` | | `XUI_NODE_TOKEN_KEY` | 单个 base64 编码的 32 字节密钥,仅在无法加载密钥文件时使用 | — | 完整列表请参阅[环境变量参考](https://docs.sanaei.dev/zh/docs/reference/env-vars)。 ## 支持的语言 面板界面提供 13 种语言: English · فارسی · العربية · 中文(简体) · 中文(繁體) · Español · Русский · Українська · Türkçe · Tiếng Việt · 日本語 · Bahasa Indonesia · Português (Brasil) ## 贡献 欢迎贡献。在提交 issue 或 pull request 之前,请阅读[贡献指南](/CONTRIBUTING.md)。 ## 特别感谢 - [alireza0](https://github.com/alireza0/) ## 致谢 - [Iran v2ray rules](https://github.com/chocolate4u/Iran-v2ray-rules) (许可证: **GPL-3.0**): _增强的 v2ray/xray 和 v2ray/xray-clients 路由规则,内置伊朗域名,专注于安全性和广告拦截。_ - [Russia v2ray rules](https://github.com/runetfreedom/russia-v2ray-rules-dat) (许可证: **GPL-3.0**): _此仓库包含基于俄罗斯被阻止域名和地址数据自动更新的 V2Ray 路由规则。_ ## 社区工具 社区围绕 3x-ui 构建的工具和集成。 - [terraform-provider-3x-ui](https://github.com/batonogov/terraform-provider-threexui) (许可证: **MIT**): _使用 Terraform / OpenTofu 通过代码管理入站、客户端、面板设置和 Xray 配置。_ - [3X-UI Manager](https://github.com/yukh975/3X-UI-Manager) (许可证: **MIT**): _3x-ui 的原生 Android 客户端 — 仪表板、入站、带二维码分享的客户端、节点以及多面板管理。可在 F-Droid 获取。_ ## 支持项目 **如果这个项目对您有帮助,您可以给它一个**:star2: <a href="https://www.buymeacoffee.com/MHSanaei" target="_blank"> <img src="./media/default-yellow.png" alt="Buy Me A Coffee" style="height: 70px !important;width: 277px !important;" > </a> </br> <a href="https://nowpayments.io/donation/hsanaei" target="_blank" rel="noreferrer noopener"> <img src="./media/donation-button-black.svg" alt="Crypto donation button by NOWPayments"> </a> ## 星标历史 <a href="https://www.star-history.com/?repos=mhsanaei%2F3x-ui&type=date&legend=top-left"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=mhsanaei/3x-ui&type=date&theme=dark&legend=top-left" /> <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=mhsanaei/3x-ui&type=date&legend=top-left" /> <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=mhsanaei/3x-ui&type=date&legend=top-left" /> </picture> </a> <p align="center"> <a href="https://www.star-history.com/mhsanaei/3x-ui"> <picture><source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/badge?repo=MHSanaei/3x-ui&type=rank&theme=dark" /><source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/badge?repo=MHSanaei/3x-ui&type=rank" /><img alt="Star History Rank" src="https://api.star-history.com/badge?repo=MHSanaei/3x-ui&type=rank" /></picture> <picture><source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/badge?repo=MHSanaei/3x-ui&type=trending&theme=dark" /><source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/badge?repo=MHSanaei/3x-ui&type=trending" /><img alt="GitHub Trending Repository of the Day" src="https://api.star-history.com/badge?repo=MHSanaei/3x-ui&type=trending" /></picture> </a> </p>