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

MHSanaei/3x-ui v3.7.0

2026-08-24 13:08 · ⭐ 4.6万 · GitHub Release 原文 ↗
#面板更新 #代理工具 #发布说明

MHSanaei/3x-ui v3.7.0

一句话概括:本次版本加入原生 AmneziaWG 支持与按日历月续费、可限定范围的 API Token,并对多节点同步、事务一致性和订阅输出做了大规模加固与修复。

新增能力

重要修复

Breaking changes / 升级注意

▸ Release Notes 英文原文(18578 字符)
## 🚀 Native AmneziaWG, Calendar-Day Renewals, Scoped API Tokens & Node-Sync Hardening - 🛡️ **Native AmneziaWG 3.1** — AmneziaWG inbounds run in-process on an embedded userspace device with a reconcile manager, so DPI-resistant peers need no kernel module, no Docker and no second panel. - 🌐 **More outbound and routing reach** — PIA WireGuard outbounds added by login, remote routing URLs, a client picker inside user rules, and geosite/geoip categories browsable straight from a routing rule. - 📅 **Client lifecycle you can actually bill against** — renewals that step whole calendar months, a per-client traffic reset cycle, a cap on auto-renewals, single-device HWID removal, per-client subscription HWID limits and per-client external-link controls. - 🔑 **Credentials that can be scoped and revoked** — API tokens now carry scopes and an optional expiry, node API tokens can be encrypted at rest, replacing the TOTP secret requires a 2FA code, and the CLI stopped quietly accumulating admin-equivalent tokens. - 🔗 **Subscription output** — client-side balancers in the JSON format, template variables in subscription metadata, an exposed last-fetch time, and a neutral copy-only page when a subscription URL is opened in a browser. - 🕸️ **Multi-node hardening** — the sync adopts a matching deployed inbound instead of recreating it, keeps disabled inbounds a snapshot cannot report, stops undoing client extensions, validates every certificate in the mTLS trust bundle, and applies a rotated master certificate without a panel restart. - 🧱 **Transactional correctness** — bulk client pushes, traffic maintenance side effects and group moves now fire only after the commit lands, and a half-applied startup migration can no longer commit silently. - 🧰 **Toolchain and supply chain** — Go 1.27, TypeScript 7 on the oxc toolchain, provenance plus SBOM attestations on published images, and release binaries stamped with their source revision. - 🖥️ **Panel polish** — a pinnable sidebar, network-only PWA installability, virtualized tables, real loading spinners, and localized log levels, access events and calendar labels. > ℹ️ **Heads-up:** First start runs **automatic schema migrations** (client reset-cycle and last-fetch columns, node sync orphan columns, a lowercase client-email index, API token scope/expiry, external-link normalization) — **take a database backup before upgrading**. Two defaults changed for existing setups: **importing a database now keeps this machine's own listen addresses, ports, base path, certificate paths and node identity** (clear the new checkbox to restore the old whole-file clone), and **opening a subscription URL in a browser returns a copy-only page** unless you append `html=1` or `view=html`. `x-ui setting -getApiToken` now **rotates a single `cli-fallback` token** instead of minting a new one, so previously printed CLI fallback tokens stop working; calendar renewal is opt-in per client, so clients left on day 0 keep the old rolling interval. Building from source now requires the **Go 1.27 toolchain**. <h3>🆕 New</h3> - [feat(amneziawg): add native AmneziaWG protocol support](https://github.com/MHSanaei/3x-ui/commit/effcccce) (#6105) @Kuzz007 - [feat(pia): add PIA login-and-add WireGuard outbounds](https://github.com/MHSanaei/3x-ui/commit/bd6a6aba) (#6272) @Masterain98 - [feat(inbound): DisableFlow — opt an inbound out of auto XTLS Vision](https://github.com/MHSanaei/3x-ui/commit/930a0ed5) (#5698) @FZ1010 - [feat(routing): add client picker to user rules](https://github.com/MHSanaei/3x-ui/commit/02002dc1) (#6271) @ZaneL1u - [feat(xray): browse geosite/geoip categories from routing rules](https://github.com/MHSanaei/3x-ui/commit/d7698ec7) (#6165) @STRENCH0 - [feat(routing): add remote routing URL support](https://github.com/MHSanaei/3x-ui/commit/380aff4d) (#6168) @yelloduxx - [feat(clients): renew on a calendar day instead of a rolling interval](https://github.com/MHSanaei/3x-ui/commit/b8903fad) (#6239) @n0ctal - [feat(clients): give each client its own traffic reset cycle](https://github.com/MHSanaei/3x-ui/commit/5c7ca5b5) (#6240) @n0ctal - [feat(clients): cap how many times a client may auto-renew](https://github.com/MHSanaei/3x-ui/commit/e940f30b) (#6238) @n0ctal - [feat(clients): allow removing a single HWID device](https://github.com/MHSanaei/3x-ui/commit/1250fbb7) (#6265) @Kuzz007 - [feat(sub): add per-client subscription HWID limits](https://github.com/MHSanaei/3x-ui/commit/694ad6de) (#5802) @rqzbeh - [feat(clients): add per-client external link controls](https://github.com/MHSanaei/3x-ui/commit/abd32099) (#5650) @fastnas2023 - [feat(limitip): let operators exempt trusted addresses from the IP limit](https://github.com/MHSanaei/3x-ui/commit/d6472740) (#6230) @n0ctal - [feat(sub): client-side balancers for the JSON subscription](https://github.com/MHSanaei/3x-ui/commit/da01b763) (#6243) @DIMFLIX - [feat(sub): add template variables to subscription metadata](https://github.com/MHSanaei/3x-ui/commit/2d669fa4) (#6163) @isultanov99 - [feat(sub): expose last subscription fetch time](https://github.com/MHSanaei/3x-ui/commit/2217213e) (#6217) @hunmar - [feat(sub): warn when salamander settings cannot reach the client](https://github.com/MHSanaei/3x-ui/commit/dafd3c0e) (#6177) @n0ctal - [feat(inbounds): add a narrow endpoint for subscription sort order](https://github.com/MHSanaei/3x-ui/commit/b4e44786) (#6179) @n0ctal - [feat(api): scoped, optionally expiring API tokens](https://github.com/MHSanaei/3x-ui/commit/1230559e) (#6201) @n0ctal - [feat(nodes): opt-in encryption at rest for the outbound node API token](https://github.com/MHSanaei/3x-ui/commit/1793a9b8) (#6186) @n0ctal - [feat(frontend): multi-node cloning initial implementation](https://github.com/MHSanaei/3x-ui/commit/8c8556ab) (#6216) @rlex - [feat(inbounds): improve multi-node online attribution](https://github.com/MHSanaei/3x-ui/commit/be70535b) (#6164) @isultanov99 - [feat(server): keep this machine's own settings when importing a database](https://github.com/MHSanaei/3x-ui/commit/6e80a468) (#6227) @n0ctal - [feat(ui): let users pin the sidebar](https://github.com/MHSanaei/3x-ui/commit/5373786f) (#6161) @PathGao - [feat(web): add network-only PWA installability](https://github.com/MHSanaei/3x-ui/commit/3a2f9b48) (#6190) @korsun009 - [feat(i18n): translate the log levels, access events and calendar labels](https://github.com/MHSanaei/3x-ui/commit/5c9268c4) (#6226) @n0ctal <h3>⚡ Update & improvement</h3> - [chore(build): bump Go toolchain to 1.27.0](https://github.com/MHSanaei/3x-ui/commit/81fcacab) - [Move to TypeScript 7 and the oxc toolchain (oxlint + oxfmt)](https://github.com/MHSanaei/3x-ui/commit/92fb94d8) (#6262) - [chore(lint): adapt to staticcheck v0.8.0 under golangci-lint v2.13.1](https://github.com/MHSanaei/3x-ui/commit/e4798a02) - [chore: bump dependencies and clear deprecated frontend APIs](https://github.com/MHSanaei/3x-ui/commit/fcf60eb2) - [chore(deps): bump google.golang.org/grpc from 1.82.1 to 1.83.0](https://github.com/MHSanaei/3x-ui/commit/138e1bd8) (#6162) - [chore(deps): bump github.com/klauspost/compress from 1.19.1 to 1.19.2](https://github.com/MHSanaei/3x-ui/commit/e2f75aca) (#6212) - [chore(deps): bump dompurify](https://github.com/MHSanaei/3x-ui/commit/75032fd4) (#6193) - [chore(deps-dev): bump postcss](https://github.com/MHSanaei/3x-ui/commit/d1423073) (#6173) - [chore(frontend): resolve the high-severity brace-expansion advisory](https://github.com/MHSanaei/3x-ui/commit/7eacce6a) (#6180) @n0ctal - [perf(clients): write client_inbounds deltas and check identity from the clients table](https://github.com/MHSanaei/3x-ui/commit/f7db247b) - [perf(frontend): replace blank Suspense fallbacks with Spin, switch to matchMedia hook, add virtual table scrolling](https://github.com/MHSanaei/3x-ui/commit/8e7fb144) (#6187) @PathGao - [refactor(tgbot): share numeric keypad transitions](https://github.com/MHSanaei/3x-ui/commit/238e4bb3) (#6211) @n0ctal - [test(tgbot): detect open-coded keypad transitions](https://github.com/MHSanaei/3x-ui/commit/aecbad3a) (#6214) @n0ctal - [ci: attach provenance and SBOM attestations to the published images](https://github.com/MHSanaei/3x-ui/commit/7c8a9a69) (#6130) @kobihikri - [ci(release): stamp released binaries with their source revision](https://github.com/MHSanaei/3x-ui/commit/dc1979a1) (#6223) @n0ctal - [ci: actually run the PostgreSQL schema and migration tests](https://github.com/MHSanaei/3x-ui/commit/2b1fe1fd) (#6224) @n0ctal - [refactor(ci): replace the in-house review lanes with the official code-review skill](https://github.com/MHSanaei/3x-ui/commit/58669f61) - [docs(api): document WireGuard and mtproto secret generation on clients/add](https://github.com/MHSanaei/3x-ui/commit/af3e6c11) (#6282) @rokokol - [chore(i18n): update tr-TR translations](https://github.com/MHSanaei/3x-ui/commit/f204997c) (#6288) @tarihcituranx - [fix(i18n): localize Chinese Xray labels](https://github.com/MHSanaei/3x-ui/commit/69a82375) (#6202) @nrps9909 <h3>🐞 Bug fixed</h3> - [fix(node): stop the node sync from deleting clients it never meant to](https://github.com/MHSanaei/3x-ui/commit/5bc81dfd) - [fix(node): stop stale expiry sync from undoing client extensions](https://github.com/MHSanaei/3x-ui/commit/6f7a3052) (#6231) @mrchatam - [fix(node): adopt a matching deployed inbound instead of recreating it](https://github.com/MHSanaei/3x-ui/commit/bb29b6af) (#6197) @n0ctal - [fix(node): keep disabled inbounds the node snapshot cannot report](https://github.com/MHSanaei/3x-ui/commit/6a674c7f) (#6221) @n0ctal - [fix(node): don't stamp InboundsAdoptedAt when the sync adopted nothing](https://github.com/MHSanaei/3x-ui/commit/a255ab7c) (#6284) @yzxcj797 - [fix(nodes): log the inbound the node snapshot removes centrally](https://github.com/MHSanaei/3x-ui/commit/4b0e9f9b) (#6219) @n0ctal - [fix(nodes): validate every certificate in the node mTLS trust bundle](https://github.com/MHSanaei/3x-ui/commit/bab39393) (#6188) @n0ctal - [fix(nodes): apply a rotated master mTLS certificate without restarting the panel](https://github.com/MHSanaei/3x-ui/commit/7ecd88b9) (#6194) @n0ctal - [fix(nodes): persist the master mTLS credential atomically and stop silent reissue](https://github.com/MHSanaei/3x-ui/commit/60453bf5) (#6195) @n0ctal - [fix(nodes): report probe heartbeat persistence failures](https://github.com/MHSanaei/3x-ui/commit/4a5f6771) (#6207) @n0ctal - [fix(clients): push bulk client changes to nodes only after the commit lands](https://github.com/MHSanaei/3x-ui/commit/c5dec64d) (#6181) @n0ctal - [fix(clients): stop a stale IP row from blocking a client edit](https://github.com/MHSanaei/3x-ui/commit/2a8c3bc0) - [fix(clients): stop recomputing the summary badges from the client_stats snapshot](https://github.com/MHSanaei/3x-ui/commit/ecadfd0e) (#6169) @mrnickson-hue - [fix(traffic): clear cross-panel rows only for clients actually renewed](https://github.com/MHSanaei/3x-ui/commit/326009e9) (#6263) @n0ctal - [fix(traffic): apply maintenance side effects only after the commit lands](https://github.com/MHSanaei/3x-ui/commit/13960050) (#6200) @n0ctal - [fix(job): expire stored client IPs of offline clients](https://github.com/MHSanaei/3x-ui/commit/103b0dfe) - [fix(job): force-disconnect over-limit Hysteria2 clients](https://github.com/MHSanaei/3x-ui/commit/d175050f) - [fix(database): keep IP limits when the fail2ban probe is inconclusive](https://github.com/MHSanaei/3x-ui/commit/17fea2f6) (#6176) @n0ctal - [fix(ldap): stop auto-delete from wiping every client on an empty directory](https://github.com/MHSanaei/3x-ui/commit/f4b7b08e) - [fix(inbounds): close the port check-and-claim race on the serial writer](https://github.com/MHSanaei/3x-ui/commit/81cfd857) (#6225) @n0ctal - [fix(inbounds): reject Hysteria inbound updates with empty client auth](https://github.com/MHSanaei/3x-ui/commit/585f4ecd) (#6268) @mvanhorn - [fix(inbounds): surface form validation errors](https://github.com/MHSanaei/3x-ui/commit/3fa88adb) (#6084) @narcotics0507 - [fix(reality): make the REALITY target check usable on a private network](https://github.com/MHSanaei/3x-ui/commit/708a69ac) (#6242) @shustovTE - [fix(groups): report changed bulk moves without restarting xray](https://github.com/MHSanaei/3x-ui/commit/0496c23a) (#6199) @n0ctal - [fix(panel): stop one poisoned DNS answer from blocking outbound tests](https://github.com/MHSanaei/3x-ui/commit/2d30ab3a) - [fix(outbounds): propagate allocation query failures](https://github.com/MHSanaei/3x-ui/commit/b70c5abc) (#6208) @n0ctal - [fix(outbound): import Hysteria2 salamander properly from standard obfs params](https://github.com/MHSanaei/3x-ui/commit/d05e44e4) (#6166) @xMasterX - [fix(warp): preserve WARP Plus license key when changing IP](https://github.com/MHSanaei/3x-ui/commit/5d6d98d1) (#6218) @rqzbeh - [fix(warp): surface update-clock persistence failures](https://github.com/MHSanaei/3x-ui/commit/64f4f074) (#6209) @n0ctal - [fix(netsafe): classify IPv6 transition and CGNAT ranges as internal](https://github.com/MHSanaei/3x-ui/commit/b51f0976) - [fix(sub): keep Hysteria2 mport on external-proxy links](https://github.com/MHSanaei/3x-ui/commit/7a595cb4) - [fix(sub): forward tlsSettings.cipherSuites into the JSON subscription](https://github.com/MHSanaei/3x-ui/commit/d9b599b9) - [fix(sub): serve a copy-only page when a subscription URL is opened in a browser](https://github.com/MHSanaei/3x-ui/commit/43bc9153) (#6183) @n0ctal - [fix(sub): restore the subscription info page for browser visits](https://github.com/MHSanaei/3x-ui/commit/f22df49a) - [fix(sub): keep copy page within mobile viewport](https://github.com/MHSanaei/3x-ui/commit/338822ab) - [fix(sub): render the full remark once per subscription, not once per credential](https://github.com/MHSanaei/3x-ui/commit/3b190915) (#6198) @n0ctal - [fix(sub): use a fullwidth percent in USAGE_PERCENTAGE](https://github.com/MHSanaei/3x-ui/commit/ad32144c) (#6174) @n0ctal - [fix(migration): stop a half-applied startup migration from committing silently](https://github.com/MHSanaei/3x-ui/commit/b56b0872) (#6182) @n0ctal - [fix(db): harden unrestricted freedom outbounds](https://github.com/MHSanaei/3x-ui/commit/3bb87e80) (#6184) @n0ctal - [fix(security): require a 2FA code to replace the stored TOTP secret](https://github.com/MHSanaei/3x-ui/commit/c8a3a2d7) - [fix(cli): stop -getApiToken accumulating admin tokens](https://github.com/MHSanaei/3x-ui/commit/34c248bb) (#6175) @n0ctal - [fix(web): fallback to default secret when database setting is empty](https://github.com/MHSanaei/3x-ui/commit/0f14ce75) (#6189) @CaMeDoZa - [fix(web): report unexpected HTTP serve failures](https://github.com/MHSanaei/3x-ui/commit/20b3f84f) (#6210) @n0ctal - [fix(frontend): make the jalali expiry clear button actually clear](https://github.com/MHSanaei/3x-ui/commit/b53a5515) - [fix(frontend): refresh subscription settings after save](https://github.com/MHSanaei/3x-ui/commit/b73ceae0) (#6287) @dawNotPoi - [fix(frontend): restore responsive table height](https://github.com/MHSanaei/3x-ui/commit/acbf09e7) - [fix(frontend): disable table virtualization](https://github.com/MHSanaei/3x-ui/commit/03950b12) - [fix(frontend): isolate swagger deps from main vendor chunk](https://github.com/MHSanaei/3x-ui/commit/8a8da885) - [fix(frontend): restore the two rolldown bindings npm dropped from the lockfile](https://github.com/MHSanaei/3x-ui/commit/ce63bf3e) - [fix(frontend): keep the MSW worker in step with the lockfile](https://github.com/MHSanaei/3x-ui/commit/f75ea08a) (#6222) @n0ctal - [fix(install): preserve custom bin/ files (e.g. hand-added geoip) across updates](https://github.com/MHSanaei/3x-ui/commit/9165ab67) (#6152) @Kuzz007 - [fix(panel): forward the panel's proxy to update.sh's own downloads](https://github.com/MHSanaei/3x-ui/commit/94084249) (#6259) @Kuzz007 - [fix(tgbot): split long messages at line boundaries](https://github.com/MHSanaei/3x-ui/commit/f13baa9a) (#6293) @sanmaxdev - [fix: dead code, typo, and minor bugs in main.go, process.go and index.go](https://github.com/MHSanaei/3x-ui/commit/31c1eed5) (#6167) @isuru709 - [fix: follow-ups from the post-merge reviews of #6221, #6227, #6230 and #6239](https://github.com/MHSanaei/3x-ui/commit/3f1dd4bf) (#6250) @n0ctal <h3> Reports </h3> ![Total Download](https://img.shields.io/github/downloads/mhsanaei/3x-ui/v3.7.0/total?label=Total-Download&color=success) ## New Contributors * @fastnas2023 made their first contribution in https://github.com/MHSanaei/3x-ui/pull/5650 * @FZ1010 made their first contribution in https://github.com/MHSanaei/3x-ui/pull/5698 * @narcotics0507 made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6084 * @kobihikri made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6130 * @Kuzz007 made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6152 * @xMasterX made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6166 * @isuru709 made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6167 * @yelloduxx made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6168 * @CaMeDoZa made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6189 * @korsun009 made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6190 * @nrps9909 made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6202 * @rlex made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6216 * @hunmar made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6217 * @mrchatam made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6231 * @shustovTE made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6242 * @DIMFLIX made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6243 * @ZaneL1u made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6271 * @Masterain98 made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6272 * @rokokol made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6282 * @yzxcj797 made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6284 * @dawNotPoi made their first contribution in https://github.com/MHSanaei/3x-ui/pull/6287 **Full Changelog**: https://github.com/MHSanaei/3x-ui/compare/v3.6.0...v3.7.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>