3x-ui/internal/web/runtime
MHSanaei 4210a50cb4 fix(traffic): make a client reset reach every counter enforcing its quota
Invariant: a client traffic reset zeroes every counter that enforces the
client's quota - the master's, each hosting node's, and the local MTProto
sidecar's. A node cuts a client on its own local counters, and the master
adopts that verdict when both judged the same limits (#4917).

Node counters: ResetClientTraffic tried the node once and dropped a
failure ("nothing replays a reset"); BulkResetTraffic,
ResetAllClientTraffics and ClientService.ResetAllTraffics never told the
node at all. The node kept its pre-reset usage, switched the client off
again on its next tick, and the master latched that - a client shown at
zero usage stayed disabled.

Every reset path now queues a node_pending_resets row per hosting node in
its own transaction. It is delivered right after commit (per-client
endpoint up to the push threshold, bulkResetTraffic above) and replayed by
the node sync ahead of its snapshot, and dropped only once the node
accepted it. While one is owed, the merge takes only that client's usage
from the node, not its enable or limits. Deliveries to a node are
serialized so a reset is not sent twice.

Sidecar quota: BulkResetTraffic, ClientService.ResetAllTraffics and
auto-renew zeroed the panel counters but not mtg's own quota counter, so
the sidecar kept refusing a renewed or reset MTProto client. They now
reset it too, scoped to the affected clients.
2026-09-28 02:56:53 +02:00
..
local.go Feature/tuic v5 (#6337) 2026-09-12 10:15:48 +02:00
manager.go fix(node): release a deleted node's metric series and HTTP client 2026-09-15 20:39:32 +02:00
manager_convergence_test.go fix(runtime): refresh cached node remotes on identity change (#5614) 2026-06-28 15:01:18 +02:00
reconcile_skip_test.go fix(node): stop client edits from tearing down node inbounds and harden reconcile fingerprints 2026-07-05 02:06:58 +02:00
remote.go fix(traffic): make a client reset reach every counter enforcing its quota 2026-09-28 02:56:53 +02:00
remote_envelope_test.go feat(node): node hardening — mTLS, hashed+zstd reconcile transport, per-node net metrics (#5382) 2026-06-16 12:19:33 +02:00
remote_mtls_test.go feat(node): node hardening — mTLS, hashed+zstd reconcile transport, per-node net metrics (#5382) 2026-06-16 12:19:33 +02:00
remote_reset_test.go fix(traffic): make a client reset reach every counter enforcing its quota 2026-09-28 02:56:53 +02:00
remote_test.go feat(inbound): excludeFromSub hides links without disabling (#6463) 2026-09-27 12:26:37 +02:00
runtime.go fix(node): fully delete clients on nodes instead of only detaching them 2026-07-05 20:28:26 +02:00
tls_client.go perf(nodes): reuse one pooled client per node instead of rebuilding it (#6548) 2026-09-15 15:29:49 +03:00
tls_client_invalidate_test.go fix(node): release a deleted node's metric series and HTTP client 2026-09-15 20:39:32 +02:00
tls_client_property_test.go Test-quality audit: fix 2 prod bugs, strengthen weak tests, add mutation/fuzz/CI tooling (#5345) 2026-06-15 15:17:03 +02:00
tls_client_test.go perf(nodes): reuse one pooled client per node instead of rebuilding it (#6548) 2026-09-15 15:29:49 +03:00
tls_client_wire_test.go fix(nodes): apply a rotated master mTLS certificate without restarting the panel (#6194) 2026-08-15 16:03:42 +02:00