mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-29 22:14:50 +03:00
feat(traffic): separate depletion restarts from client disables (#7267)
One switch decided two things: whether Xray restarts when a client is disabled or deleted by hand, and whether it restarts when a client runs out of quota or expires. A panel that takes many API deletes had to choose between a restart on each of them and leaving depleted clients' open connections alive. Add a switch for the quota and expiry case. It inherits the old switch until it is saved, and older settings clients may omit it. A depletion asks for one restart per affected running core per committed batch: the local core when a local inbound served the client, and each affected node through the node API. A master whose nodes alone served the client is not restarted. With the new switch off, a depleted client is still removed from the running core and from its config snapshot, so a later reconcile does not restart for it either. Also add a node traffic fetch timeout setting (1 to 30 seconds, default 4). Run on a panel with real cores: with the old switch off and the new one on, a stream through a client that crossed its quota was cut within one poll and the lifecycle log names client_depletion; with them swapped, the stream and the core survived. A depletion a node detects itself follows that node's own switches. Refs #7145
This commit is contained in:
@@ -27,9 +27,11 @@ inbounds** at once, with per-client traffic accounting.
|
||||
| **Comment** | all | Free-text note. |
|
||||
|
||||
<Callout type="info">
|
||||
Reaching the **traffic** or **expiry** limit disables the client, and a client
|
||||
disabled or deleted by hand counts too; the panel restarts Xray then
|
||||
(`restartXrayOnClientDisable`, on by default).
|
||||
Reaching the **traffic** or **expiry** limit disables the client.
|
||||
`restartXrayOnClientDepleted` controls whether Xray restarts to close the
|
||||
client's existing sessions. Manual disable and delete use
|
||||
`restartXrayOnClientDisable`. The new setting inherits the old value until
|
||||
explicitly configured.
|
||||
</Callout>
|
||||
|
||||
## Block a subscription device
|
||||
|
||||
@@ -172,3 +172,16 @@ a 2xx status within 3 seconds, the panel drops that batch, logs one warning
|
||||
with the reason, and logs again when deliveries resume. Deltas waiting for the
|
||||
next send are held in memory: disabling the webhook or a panel process exit
|
||||
discards them.
|
||||
|
||||
### Xray restart policy
|
||||
|
||||
**Restart Xray on client quota or expiry** is independent of the existing
|
||||
disable/delete switch. It can close already accepted sessions for clients
|
||||
disabled automatically on the panel or on a managed node. Restarts are coalesced
|
||||
per depletion batch and per affected node. Remote restart requests use a bounded
|
||||
best-effort call. If the new setting is unset, it inherits the old switch until
|
||||
saved explicitly.
|
||||
|
||||
**Node traffic fetch timeout** defaults to 4 seconds and accepts values from
|
||||
1 to 30 seconds. It applies to the snapshot fetch. Local traffic polling keeps
|
||||
its existing cadence.
|
||||
|
||||
@@ -177,6 +177,10 @@
|
||||
"minimum": 1,
|
||||
"type": "integer"
|
||||
},
|
||||
"nodeTrafficFetchTimeout": {
|
||||
"example": 4,
|
||||
"type": "integer"
|
||||
},
|
||||
"outboundDownThreshold": {
|
||||
"maximum": 100,
|
||||
"minimum": 1,
|
||||
@@ -211,6 +215,10 @@
|
||||
"remarkTemplate": {
|
||||
"type": "string"
|
||||
},
|
||||
"restartXrayOnClientDepleted": {
|
||||
"nullable": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"restartXrayOnClientDisable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@@ -733,6 +741,7 @@
|
||||
"networkTrafficInterface",
|
||||
"networkTrafficMode",
|
||||
"nodeDownThreshold",
|
||||
"nodeTrafficFetchTimeout",
|
||||
"outboundDownThreshold",
|
||||
"pageSize",
|
||||
"panelOutbound",
|
||||
@@ -1075,6 +1084,10 @@
|
||||
"minimum": 1,
|
||||
"type": "integer"
|
||||
},
|
||||
"nodeTrafficFetchTimeout": {
|
||||
"example": 4,
|
||||
"type": "integer"
|
||||
},
|
||||
"outboundDownThreshold": {
|
||||
"maximum": 100,
|
||||
"minimum": 1,
|
||||
@@ -1109,6 +1122,10 @@
|
||||
"remarkTemplate": {
|
||||
"type": "string"
|
||||
},
|
||||
"restartXrayOnClientDepleted": {
|
||||
"nullable": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"restartXrayOnClientDisable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@@ -1641,6 +1658,7 @@
|
||||
"networkTrafficInterface",
|
||||
"networkTrafficMode",
|
||||
"nodeDownThreshold",
|
||||
"nodeTrafficFetchTimeout",
|
||||
"outboundDownThreshold",
|
||||
"pageSize",
|
||||
"panelOutbound",
|
||||
|
||||
Reference in New Issue
Block a user