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

MHSanaei/3x-ui v3.9.0

2026-10-03 11:38 · ⭐ 4.7万 · GitHub Release 原文 ↗
#版本发布 #协议支持 #安全加固

MHSanaei/3x-ui v3.9.0

一句话概括:本次发布把 TUIC v5 变成面板内置的 Go 原生服务,支持在节点上直接创建 AmneziaWG/TUIC/MTProto 入站,升级到 Xray-core v26.9.30,并大幅修复客户端流量重置、续费与配额在多节点间的同步问题(含多项必须手动处理的兼容性变更)。

新增能力

性能与改进

修复重点

⚠️ 升级前必读(Breaking Change / 需手动操作)

自动迁移与运行要求

▸ Release Notes 英文原文(20034 字符)
## 🚀 Native TUIC, Tunnels on Nodes, Xray-core v26.9.30 & Reliable Client Resets - 🚀 **Native TUIC v5 server** — TUIC now runs inside the panel in Go, with no external binary to download, BBR congestion control and crash-safe traffic accounting. - 🌐 **AmneziaWG, TUIC & MTProto on nodes** — these inbounds can now be created and cloned from the master straight onto a node. - ⚙️ **Xray-core v26.9.30** — stored XDNS masks and WireGuard outbound settings are migrated to the new core's shape automatically. - 🔁 **Client lifecycle you can trust** — resets, renewals and quota cuts now reach every counter on every node, and saving an inbound or editing a client no longer reverts changes made in the meantime. - 🤖 **Telegram bot access levels** — unknown accounts are locked out, customers link themselves with an invite link, and admins can broadcast to every client. - 🗓️ **Weekly calendar renewal** — clients can renew on a fixed weekday, with a preview of the upcoming schedule. - 📦 **Subscription controls** — hide an inbound from subscriptions without disabling it, carry traffic through export/import, and set the User-Agent used for external subscriptions. - 🔐 **Security hardening** — API token rotation, database restore, certificate fetching and the bot's command surface are all tightened. --- ## ⚠️ Before you upgrade ### Action required - `/panel/api/inbounds/update` and the inbound JSON editor no longer change which clients an inbound holds, their enable/expiry/quota/renewal fields, or the inbound's own enable flag — **do this:** move any script that edits clients through an inbound update to the client endpoints, and use `/panel/api/inbounds/setEnable/:id` to switch an inbound on or off. - The Telegram bot now answers only `/start` and `/id` for accounts that are not linked to a client or listed as an admin — **do this:** link customers who used `/usage` or `/status` by setting their Telegram ID on the client, or send them the new invite link from the client card. - XDNS finalmask changed its wire format in Xray-core v26.9.30 — **do this:** update clients that use an XDNS mask to a core of v26.9.30 or newer, or they will not connect. - Weekly renewal is ignored by older binaries, and an older panel's depleted-client cleanup can delete a weekly-only client — **do this:** upgrade every node before enabling weekly mode, and convert weekly clients to another mode before any downgrade. - Deploying an AmneziaWG, TUIC or MTProto inbound to a node is refused when the node is older than the release that introduced the protocol (MTProto v3.5.0, AmneziaWG v3.7.0, TUIC v3.8.0) — **do this:** upgrade the node first. - WireGuard and AmneziaWG `allowedIPs` that overlap another client's range are now rejected; existing overlapping clients keep working but cannot be saved until fixed — **do this:** narrow such ranges (for example `10.10.2.9/24` → `10.10.2.9/32`) when editing them. - Self-built Docker images: the frontend stage now uses Node 26 — **do this:** rebuild from the updated `Dockerfile`; an older copy fails at `npm ci`. ### Automatic — no action needed - One-time startup migrations rewrite stored XDNS finalmasks (inbounds, hosts, Xray template, JSON-subscription mask, cached outbound subscriptions) into the new object shape, and move a WireGuard outbound's `domainStrategy` to `sockopt.domainStrategy` / `targetStrategy` (`remoteDNS: "local"` becomes `targetStrategy`). They also add the `excludeFromSub` and weekly-renewal columns and the `node_pending_resets` and `tuic_traffic_receipts` tables. A migration failure stops the panel from starting. - The install and update scripts remove the old `tuic-server` binary, its `bin/tuic` configs and any leftover processes; TUIC inbounds come back up on the built-in server. - `x-ui setting -getApiToken -tokenName <name>` now keeps the regenerated token's scope and expiry instead of turning it into a non-expiring admin token; an already expired token is refused rather than rotated. - The panel fetches the sponsor list from `sponsors.sanaei.dev` at most once an hour and proxies sponsor logos itself, so admin browsers never contact a third party. ### Requirements Go 1.27.1 · Xray-core v26.9.30 · Node 26 (only for building the frontend from source) --- ### 🔐 Security - Regenerating a named API token from the CLI no longer silently turns a scoped or expiring token into a permanent full-admin one ([#6700](https://github.com/MHSanaei/3x-ui/pull/6700)) @rokokol - Fetching a remote certificate for pinning now refuses private and loopback addresses unless the admin confirms, matching the REALITY target scan ([`ede275e4`](https://github.com/MHSanaei/3x-ui/commit/ede275e4)) - Restoring a SQL dump can no longer open or create any database file other than the panel's own ([`d31465e3`](https://github.com/MHSanaei/3x-ui/commit/d31465e3)) - The Telegram bot no longer lets unlinked accounts run client commands or press client buttons; invite-link claims are rate-limited and cannot be used to probe for valid subscription IDs ([#6518](https://github.com/MHSanaei/3x-ui/pull/6518)) @pcxzs - Saving an inbound no longer restores a client that was deleted while the edit dialog was open, which brought revoked credentials back to life ([`823db059`](https://github.com/MHSanaei/3x-ui/commit/823db059)) - Subscriptions can tell supported client apps to require authentication on their local SOCKS/HTTP proxy, so other apps on the device can no longer use it to bypass per-app routing or learn the server address ([#6628](https://github.com/MHSanaei/3x-ui/pull/6628)) @rudenko-ks ### 🆕 New - TUIC v5 is now served by a native in-process Go server with BBR/New Reno congestion control, native and QUIC UDP relay, full Xray routing and a durable traffic journal — no external binary ([#6577](https://github.com/MHSanaei/3x-ui/pull/6577)) @poise52 - AmneziaWG, TUIC and MTProto inbounds can be created and cloned onto nodes from the master ([`ed31ee43`](https://github.com/MHSanaei/3x-ui/commit/ed31ee43)) - Calendar weekly renewal, plus a preview of upcoming renewal dates in the individual and bulk client forms ([#6524](https://github.com/MHSanaei/3x-ui/pull/6524)) @JacktheRanger - Telegram bot invite links: the client card offers a link that binds the first account to open it ([#6518](https://github.com/MHSanaei/3x-ui/pull/6518)) @pcxzs - Telegram bot `/broadcast` sends any admin message — text, media or a whole album — to every linked client, with progress and cancel ([#6510](https://github.com/MHSanaei/3x-ui/pull/6510)) @DIMFLIX - Per-inbound "exclude from subscription" hides an inbound's links while it keeps serving and counting traffic ([#6463](https://github.com/MHSanaei/3x-ui/pull/6463)) @mrchatam - Portable client export/import now carries traffic counters, without inflating group totals ([#6469](https://github.com/MHSanaei/3x-ui/pull/6469)) @mrchatam - Visual routing-profile editor for client apps, with optional ad blocking and a LAN-bypass preset ([#6545](https://github.com/MHSanaei/3x-ui/pull/6545)) @NgaiYeanCoi - App-management subscription headers for a second client app: per-app split tunnelling, fragmentation, UDP noise, DoH pre-resolution, banners and more ([#6650](https://github.com/MHSanaei/3x-ui/pull/6650)) @DIMFLIX - Configurable User-Agent for fetching external subscriptions ([#6613](https://github.com/MHSanaei/3x-ui/pull/6613)) @mrchatam - `x-ui setting -getApiToken -tokenScope <scope>` chooses the scope of the issued token ([#6700](https://github.com/MHSanaei/3x-ui/pull/6700)) @rokokol - Finalmask noise items accept the new tag-expression type, and TUN exposes the new gateway-DNS and leak-block options ([`62423cac`](https://github.com/MHSanaei/3x-ui/commit/62423cac)) - Sponsor slots on the overview, sidebar and login page plus a Sponsors page, with scheduled start dates; each slot can be hidden for 24 hours ([`fd7b3559`](https://github.com/MHSanaei/3x-ui/commit/fd7b3559), [`09617f04`](https://github.com/MHSanaei/3x-ui/commit/09617f04), [`dcaadd48`](https://github.com/MHSanaei/3x-ui/commit/dcaadd48)) ### ⚡ Improved - Xray-core updated to v26.9.30 ([`62423cac`](https://github.com/MHSanaei/3x-ui/commit/62423cac)) - Go, frontend and docs dependencies refreshed; the frontend baseline is now Node 26 / npm 11 ([`86302d2f`](https://github.com/MHSanaei/3x-ui/commit/86302d2f), [`99bc68fa`](https://github.com/MHSanaei/3x-ui/commit/99bc68fa)) - TUIC throughput through Xray rises from about 2.4 to 3.4 Gbit/s on loopback with BBR ([#6577](https://github.com/MHSanaei/3x-ui/pull/6577)) @poise52 - The client-app settings page is folded from seven tabs into four ([`8f47b538`](https://github.com/MHSanaei/3x-ui/commit/8f47b538)) - The test suite runs several times faster and isolates each package on PostgreSQL ([`12d51d71`](https://github.com/MHSanaei/3x-ui/commit/12d51d71), [#6594](https://github.com/MHSanaei/3x-ui/pull/6594)) @n0ctal - README screenshots refreshed for the current UI ([`17d7dd46`](https://github.com/MHSanaei/3x-ui/commit/17d7dd46)) ### 🐞 Fixed **Clients & traffic** - Saving an inbound no longer reverts client renewals, expiry, quotas, clients added meanwhile, the inbound's enable switch or traffic counted while the dialog was open ([`1110caaa`](https://github.com/MHSanaei/3x-ui/commit/1110caaa), [`823db059`](https://github.com/MHSanaei/3x-ui/commit/823db059)) - Adding, editing or deleting a client no longer undoes a renewal of another client that committed at the same moment ([`63ffc083`](https://github.com/MHSanaei/3x-ui/commit/63ffc083)) - A client traffic reset now reaches every node hosting the client and the MTProto quota, so a reset client is no longer switched off again on the next tick ([`4210a50c`](https://github.com/MHSanaei/3x-ui/commit/4210a50c)) - A client that ran out of quota or time is now dropped from every inbound it belongs to, not only the last one it was attached to ([`7c84ca96`](https://github.com/MHSanaei/3x-ui/commit/7c84ca96)) - Resetting an inbound's traffic on a node now hits that inbound instead of an unrelated one ([#6717](https://github.com/MHSanaei/3x-ui/pull/6717)) @ChesterFishmansWork **Subscriptions** - JSON subscriptions for REALITY inbounds with a Host SNI no longer ship a config the client core refuses to start ([#6691](https://github.com/MHSanaei/3x-ui/pull/6691)) @FZ1010 - WireGuard, AmneziaWG and TUIC configs now advertise the inbound's Hosts on every surface, not the panel address ([`aee45ca3`](https://github.com/MHSanaei/3x-ui/commit/aee45ca3)) - A client on several WireGuard/AmneziaWG inbounds now gets each inbound's own keys and address in its subscription ([#6653](https://github.com/MHSanaei/3x-ui/pull/6653)) @mvanhorn **Protocols** - Hysteria client changes are applied live instead of restarting the inbound and stalling every connected client ([#6606](https://github.com/MHSanaei/3x-ui/pull/6606)) @iblchv - A WireGuard `allowedIPs` written as `10.10.2.9/24` can no longer claim other clients' traffic ([`c8a182b6`](https://github.com/MHSanaei/3x-ui/commit/c8a182b6)) <details><summary>All 45 fixes in this release</summary> **Clients & traffic** - Saving an inbound no longer reverts client renewals, expiry, quotas, clients added meanwhile, the inbound's enable switch or traffic counted while the dialog was open ([`1110caaa`](https://github.com/MHSanaei/3x-ui/commit/1110caaa), [`823db059`](https://github.com/MHSanaei/3x-ui/commit/823db059)) - Adding, editing or deleting a client no longer undoes a renewal of another client that committed at the same moment ([`63ffc083`](https://github.com/MHSanaei/3x-ui/commit/63ffc083)) - A traffic reset no longer leaves a quota-disabled client looking enabled while it is dropped from the core ([`feb8451b`](https://github.com/MHSanaei/3x-ui/commit/feb8451b)) - A client traffic reset now reaches every node hosting the client and the MTProto quota, so a reset client is no longer switched off again on the next tick ([`4210a50c`](https://github.com/MHSanaei/3x-ui/commit/4210a50c)) - Resetting inbound traffic no longer hands every MTProto client a fresh quota, and a per-inbound client reset no longer touches other inbounds ([`fb7418f7`](https://github.com/MHSanaei/3x-ui/commit/fb7418f7)) - A client that ran out of quota or time is now dropped from every inbound it belongs to, not only the last one it was attached to ([`7c84ca96`](https://github.com/MHSanaei/3x-ui/commit/7c84ca96)) - Resetting an inbound's traffic on a node now hits that inbound instead of an unrelated one ([#6717](https://github.com/MHSanaei/3x-ui/pull/6717)) @ChesterFishmansWork - Inbounds exported from v2.x panels import again ([`15d82a5e`](https://github.com/MHSanaei/3x-ui/commit/15d82a5e)) - A WireGuard `allowedIPs` written as `10.10.2.9/24` can no longer claim other clients' traffic ([`c8a182b6`](https://github.com/MHSanaei/3x-ui/commit/c8a182b6)) - Client search and group filter match names with non-ASCII capitals ([#6685](https://github.com/MHSanaei/3x-ui/pull/6685)) @freeb5d - Changing a client's device limit can no longer be overwritten by a concurrent traffic cycle ([#6591](https://github.com/MHSanaei/3x-ui/pull/6591)) @n0ctal - IP-limit bans reach fail2ban only after the scan is saved, so a failed save can no longer ban addresses the panel never recorded ([#6590](https://github.com/MHSanaei/3x-ui/pull/6590)) @n0ctal - On PostgreSQL, concurrent IP-limit updates no longer drop node-reported IPs ([#6612](https://github.com/MHSanaei/3x-ui/pull/6612)) @mrchatam **Subscriptions & links** - JSON subscriptions for REALITY inbounds with a Host SNI no longer ship a config the client core refuses to start ([#6691](https://github.com/MHSanaei/3x-ui/pull/6691)) @FZ1010 - Spider settings in a REALITY spiderX query are kept in share links and JSON subscriptions ([#6694](https://github.com/MHSanaei/3x-ui/pull/6694)) @FZ1010 - VLESS REALITY share links carry the ML-KEM key-exchange hint ([#6712](https://github.com/MHSanaei/3x-ui/pull/6712)) @libmur-dev - Fragment settings export in a form older client cores understand, and inbounds with UDP-only masks no longer break the QR, info and export views ([#6702](https://github.com/MHSanaei/3x-ui/pull/6702)) @artemk1337 - WireGuard, AmneziaWG and TUIC configs now advertise the inbound's Hosts on every surface, not the panel address ([`aee45ca3`](https://github.com/MHSanaei/3x-ui/commit/aee45ca3)) - A client on several WireGuard/AmneziaWG inbounds now gets each inbound's own keys and address in its subscription ([#6653](https://github.com/MHSanaei/3x-ui/pull/6653)) @mvanhorn - Clash subscriptions include the Hysteria2 certificate pin, so self-signed certificates are accepted ([#6651](https://github.com/MHSanaei/3x-ui/pull/6651)) @libmur-dev - Clash subscriptions keep the encryption of external VLESS links ([#6576](https://github.com/MHSanaei/3x-ui/pull/6576)) @SakikoTogawa0214 - The server description in external link remarks is no longer mangled ([#6580](https://github.com/MHSanaei/3x-ui/pull/6580)) @sdhfsl - Outbound subscription fetches send the same device ID as external links, so device-limited providers count the panel once ([#6579](https://github.com/MHSanaei/3x-ui/pull/6579)) @sdhfsl - Behind a proxy that sends only `X-Real-IP`, links no longer advertise the subscriber's own IP as the server ([#6608](https://github.com/MHSanaei/3x-ui/pull/6608)) @mrchatam - The JSON-subscription template no longer triggers a deprecation warning for its direct outbound ([#6609](https://github.com/MHSanaei/3x-ui/pull/6609)) @mrchatam - Downloads on phones keep their file name, so `peer.conf` is no longer saved as `peer.conf.txt` ([`99047c0a`](https://github.com/MHSanaei/3x-ui/commit/99047c0a)) **Protocols & core** - Hysteria client changes are applied live instead of restarting the inbound and stalling every connected client ([#6606](https://github.com/MHSanaei/3x-ui/pull/6606)) @iblchv - An IPv4 inbound can share a port with an IPv6-only wildcard inbound ([#6603](https://github.com/MHSanaei/3x-ui/pull/6603)) @lin-finegold - `config.json` is written after a hot apply, so config backups no longer upload stale rules ([#6686](https://github.com/MHSanaei/3x-ui/pull/6686)) @freeb5d - AmneziaWG no longer redirects connections to a sniffed domain, and its IPv6 egress no longer breaks IPv4 traffic ([#6654](https://github.com/MHSanaei/3x-ui/pull/6654)) @rudenko-ks - AmneziaWG padding and header ranges are validated the way the engine enforces them, accepting real configs that were refused and rejecting ones that would fail to start ([#6642](https://github.com/MHSanaei/3x-ui/pull/6642)) @rudenko-ks - AmneziaWG tunnels without IPv6 stop resolving AAAA records, and the outbound form exposes I2–I5 ([#6611](https://github.com/MHSanaei/3x-ui/pull/6611)) @mrchatam - AmneziaWG inbounds and outbounds work on Windows builds ([`044e2926`](https://github.com/MHSanaei/3x-ui/commit/044e2926), [`75f3702d`](https://github.com/MHSanaei/3x-ui/commit/75f3702d)) - The node-token key file loads on Windows ([`3fc3992a`](https://github.com/MHSanaei/3x-ui/commit/3fc3992a)) **Bots** - The Telegram bot picks up Panel Outbound when Xray starts after it, instead of staying unreachable on filtered hosts ([`bb18734c`](https://github.com/MHSanaei/3x-ui/commit/bb18734c)) - The bot's individual-links and QR actions work when the subscription host does not resolve from the server ([`4df570b3`](https://github.com/MHSanaei/3x-ui/commit/4df570b3)) - The bot's add-client wizard offers WireGuard and AmneziaWG inbounds and no longer shows an empty picker ([#6621](https://github.com/MHSanaei/3x-ui/pull/6621)) @romus204 - Two admins in one group chat no longer share one add-client wizard ([#6604](https://github.com/MHSanaei/3x-ui/pull/6604)) @sdhfsl **Panel & system** - Panel navigation recovers after an update leaves the browser with stale page chunks ([#6679](https://github.com/MHSanaei/3x-ui/pull/6679)) @mvanhorn - The Syslog view no longer hangs on a slow journal ([#6689](https://github.com/MHSanaei/3x-ui/pull/6689)) @freeb5d - On EL7, firewalld pulled in by fail2ban no longer blocks the panel's ports ([#6688](https://github.com/MHSanaei/3x-ui/pull/6688)) @freeb5d - The `x-ui` menu opens instantly on hosts with large journals ([`092cbd55`](https://github.com/MHSanaei/3x-ui/commit/092cbd55)) - A legacy inbound-tag cleanup no longer fails every startup migration when its target tag already exists ([#6592](https://github.com/MHSanaei/3x-ui/pull/6592)) @n0ctal - The Docker image builds again ([`9b957b96`](https://github.com/MHSanaei/3x-ui/commit/9b957b96)) - The REALITY "Min Client Ver" hint states which cores accept every client when the field is empty ([`3308c816`](https://github.com/MHSanaei/3x-ui/commit/3308c816)) </details> --- ### Reports ![Total Download](https://img.shields.io/github/downloads/mhsanaei/3x-ui/v3.9.0/total?label=Total-Download&color=success) ### New Contributors * @pcxzs made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6518 * @SakikoTogawa0214 made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6576 * @lin-finegold made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6603 * @iblchv made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6606 * @romus204 made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6621 * @rudenko-ks made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6628 * @libmur-dev made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6651 * @freeb5d made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6685 * @artemk1337 made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6702 * @ChesterFishmansWork made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6717 **Full Changelog**: https://github.com/MHSanaei/3x-ui/compare/v3.8.10...v3.9.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>