Files
3x-ui/docs/content/docs/zh/config/clients.mdx
T
BlindMaster24 e790f46757 fix(xray): restart when a diff strands a client's live session (#6550)
* fix(xray): restart when a diff strands a client's live session

Disabling or deleting a client took it out of the generated config and the
hot path applied that with AlterInbound/RemoveUser, which only drops the
credential (vless, vmess, trojan and shadowsocks all keep the established
session running) -- so the panel showed a disabled client whose connection
kept passing traffic, and the core offers no API to close one session.

A diff that removes a user without re-adding the same email under the same
tag is that case: honour the operator's restart-on-client-disable setting and
let the caller replace the process, which is already how an auto-disabled
client loses its session. An edit re-adds the email and keeps the hot path.

* chore(i18n): cover manual disable and delete in the restart-setting description

The setting now also decides what happens when a client is disabled or deleted
by hand, so the description cannot keep naming only the automatic path. All 13
locales updated in the same commit to keep the wording consistent.

* fix(xray): reach the guard from the manual switch and from every protocol

Round-1 findings on this PR. The guard sat in tryHotApply, but a manual disable
or delete applies through runtime.Runtime and finishes with needRestart false,
so none of the three RestartXray schedulers fired and the predicate was never
reached: the session in #6533 kept flowing. The apply layer now asks for the
restart the setting promises when the client actually leaves the config, on the
single-client update and delete paths and on bulk disable, and only for local
inbounds so a node row cannot make the master restart its own core.

The predicate itself could not fire for shadowsocks or hysteria either, because
RemovedUsers is only produced for the protocols diffInboundUsers will diff. The
diff now also compares settings.clients of an inbound present in both configs,
which is the one shape every account list shares, so those protocols reach the
guard through the inbound instead of through nothing.

TestManualClientDisableHonoursRestartSetting fails without the apply-layer fix
("needRestart = false, want true" with the setting on) and
TestHotDiffDropsUsersOnProtocolsItCannotDiff fails without the diff fix -- both
watched red. The two three-line comments this PR added are back inside the cap.

* docs(i18n): stop scoping restartXrayOnClientDisable to auto-disable

The setting now covers a client disabled or deleted by hand as well, so its
title no longer says "Auto" in all 13 locales, and the docs callouts in en, ru,
zh and fa describe the same behaviour instead of the auto-only one.
2026-09-15 15:39:40 +03:00

65 lines
4.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: 客户端
description: 管理 3x-ui 客户端——凭据、流量与到期限制、IP 限制、分组、批量操作、外部链接以及在线状态。
icon: Users
---
**客户端**是由唯一的**电子邮箱**标识的单个用户。在当前版本的
面板中,客户端是一等记录,可以同时关联到**多个入站**,并对每个客户端单独进行流量统计。
## 客户端字段
| 字段 | 适用于 | 含义 |
| -------------- | --------------------- | ------------------------------------------------------------------ |
| **Email** | 全部 | 用于统计和查询的唯一标识符。 |
| **ID (UUID)** | VLESS、VMess、TUIC | 客户端凭据。 |
| **Password** | Trojan、Shadowsocks、TUIC | 客户端凭据。 |
| **Auth** | Hysteria2 | 客户端凭据。 |
| **Flow** | VLESS | XTLS 流控,例如 `xtls-rprx-vision`。 |
| **Limit IP** | 全部(TUIC 除外) | 最大同时连接的源 IP 数量(通过 Fail2ban 强制执行)。 |
| **Total (GB)** | 全部(TUIC 除外) | 流量配额;用尽后客户端将被禁用(对于 TUIC,限制在入站级别设置)。 |
| **Expiry** | 全部 | 该日期之后客户端停止工作。 |
| **Reset** | 全部 | 以**天**为单位的自动续期周期(滚动重置配额)。 |
| **Telegram ID**| 全部 | 将客户端关联到 Telegram 用户,用于自助服务/通知。 |
| **Sub ID** | 全部 | 用于对该客户端链接分组的订阅标识符。 |
| **Group** | 全部 | 可选的客户端分组,便于组织管理和批量筛选。 |
| **Comment** | 全部 | 自由文本备注。 |
<Callout type="info">
达到**流量**或**到期**限制会禁用客户端,手动禁用或删除客户端同样如此;
此时面板会重启 Xray`restartXrayOnClientDisable`,默认开启)。
</Callout>
## 限制与 IP 控制
- **流量 / 到期**上限达到时会禁用客户端;**Reset** 周期可
自动续期配额。
- **Limit IP** 限制同时连接的源 IP 数量。其强制执行依赖于 Fail2ban——
参见 [安全](/docs/operations/security)。你可以查看某个客户端最近使用的 IP,
并从该客户端的操作中清除它们。
- 系统会按客户端(在多节点部署中还会按节点)跟踪**在线状态**和**最后在线**时间。
## 分享链接与外部链接
每个客户端都有针对其各入站的分享链接和二维码,外加一个合并的
[订阅](/docs/config/subscription)。你还可以为客户端附加**外部
链接**——额外的 `vless://`、`vmess://`、`trojan://`、`ss://`、
`hysteria2://` 或 `wireguard://` 链接,或一个远程订阅 URL——使它们
与面板生成的链接一起出现在该客户端的订阅中。
要查看链接的确切内容,可将其粘贴到
[分享链接检查器](/docs/config/share-links)中。
## 批量操作
为便于一次性管理大量客户端,面板支持批量**创建、启用、
禁用、删除、关联/解除关联**(到入站)、**重置流量**以及
**调整**(增加天数 / 增加字节 / 设置 flow)。维护操作还允许你
删除**已耗尽**的客户端(配额/到期用尽)和**孤立**的客户端
(未关联到任何入站)。
<Callout type="warn">
客户端的分享链接包含其凭据。请像对待密码一样对待链接和二维码,
一旦泄露应立即轮换凭据。
</Callout>