3x-ui/web/controller
Rouzbeh† 9f31d7d056
feat: synchronize access.log client IPs across nodes (#5098)
* feat: synchronize access.log client IPs across nodes for global fail2ban limits

* fix(nodes): harden cross-node client-IP merge for cluster fail2ban

MergeInboundClientIps inserted new rows with the remote node's primary key,
which collides with the independently auto-incremented local id and rolled
back the whole sync batch — breaking exactly the node-only clients the
feature targets. It also never evicted stale IPs, so the 30-minute cutoff
was defeated cluster-wide (the master pushed its unpruned table back to
nodes, which re-added IPs they had just pruned) and the blobs grew unbounded.

- drop the remote id on create (Id=0) and guard the email-unique race with
  ON CONFLICT DO NOTHING; also fixes a latent Postgres sequence collision
- apply the same 30-minute stale cutoff inside the merge and skip creating
  node-only rows whose IPs are all stale
- throttle the IP fetch/merge/push to ~10s (data only refreshes every 10s)
  instead of running on every 5s traffic tick, cutting SQLite write churn
- log the load error on the push path and tidy the merge response message
- add unit tests for the merge (remote-id, dedup, stale-drop, skips)

---------

Co-authored-by: Rqzbeh <Rqzbeh@example.com>
Co-authored-by: Sanaei <ho3ein.sanaei@gmail.com>
2026-06-09 00:59:50 +02:00
..
api.go refactor(api)!: move /panel/setting and /panel/xray under /panel/api 2026-06-06 16:22:41 +02:00
api_docs_test.go refactor(api)!: move /panel/setting and /panel/xray under /panel/api 2026-06-06 16:22:41 +02:00
base.go v3 2026-05-10 02:13:42 +02:00
client.go feat(nodes): multi-hop node attribution for chained sub-nodes (#4983) (#5005) 2026-06-06 12:33:39 +02:00
custom_geo.go v3 2026-05-10 02:13:42 +02:00
dist.go fix(api-docs): target the panel base path in OpenAPI servers 2026-06-06 16:22:08 +02:00
dist_test.go fix(api-docs): target the panel base path in OpenAPI servers 2026-06-06 16:22:08 +02:00
group.go refactor(clients): coherent group management — rename, split, extract 2026-05-28 12:59:20 +02:00
inbound.go fix(inbounds): drop unknown nodeId when importing an inbound 2026-06-08 23:04:19 +02:00
index.go fix(auth): invalidate sessions when 2FA is enabled, fix dev 401 loop 2026-05-13 14:08:16 +02:00
login_limiter.go Implement CSRF protection and security hardening across the application (#4179) 2026-05-07 23:36:11 +02:00
login_limiter_test.go refactor(websocket): split controller into service + thin controller 2026-05-08 00:00:44 +02:00
node.go feat(nodes): multi-hop node attribution for chained sub-nodes (#4983) (#5005) 2026-06-06 12:33:39 +02:00
server.go feat: synchronize access.log client IPs across nodes (#5098) 2026-06-09 00:59:50 +02:00
setting.go feat: complete Zod migration of frontend + bulk client batching (#4599) 2026-05-27 04:26:50 +02:00
util.go fix(node): keep client/inbound edits working when a node is offline (#4923, #4931) 2026-06-05 02:26:57 +02:00
util_test.go Security hardening: sessions, SSRF, CSP nonce, CSRF logout, trusted proxies (#4275) 2026-05-13 12:52:52 +02:00
websocket.go v3 2026-05-10 02:13:42 +02:00
xray_setting.go feat: add support for subscription-based outbounds with auto-update (#5037) 2026-06-08 18:09:53 +02:00
xui.go refactor(api)!: move /panel/setting and /panel/xray under /panel/api 2026-06-06 16:22:41 +02:00