3x-ui/web
MHSanaei c394938f01
refactor(websocket): split controller into service + thin controller
Move per-connection lifecycle out of the controller and into a new
service.WebSocketService. The controller is now HTTP-layer only:
authenticate, validate origin, upgrade, and hand the connection off.

- web/service/websocket.go (new): owns the read/write pumps, hub
  registration, and connection lifetime. Pump constants are prefixed
  (wsWriteWait, wsPongWait, wsPingPeriod, wsClientReadLimit) to avoid
  collisions in the larger service package namespace.
- web/controller/websocket.go: trimmed to the upgrader, same-origin
  check, auth gate, and hand-off to the service.
- web/web.go: wires controller.NewWebSocketController(service.NewWebSocketService(hub)).

The hub package (web/websocket) stays as low-level fan-out
infrastructure. Behavior is unchanged — this is a structural cleanup
to align with the rest of the codebase's controller/service split.

Also includes a small range-int modernization in login_limiter_test.go
that gopls flagged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-08 00:00:44 +02:00
..
assets fix(websocket): guard stale events and disconnect race in JS client 2026-05-08 00:00:10 +02:00
controller refactor(websocket): split controller into service + thin controller 2026-05-08 00:00:44 +02:00
entity feat: add configurable auto-restart on client auto-disable 2026-05-04 23:19:25 +02:00
global Refactor code and fix linter warnings (#3627) 2026-01-05 05:54:56 +01:00
html Implement CSRF protection and security hardening across the application (#4179) 2026-05-07 23:36:11 +02:00
job fix(fail2ban): fix banning regression and Docker zero-jail issue 2026-05-07 13:53:34 +02:00
locale update dependencies 2026-03-04 13:05:29 +01:00
middleware Implement CSRF protection and security hardening across the application (#4179) 2026-05-07 23:36:11 +02:00
network docs: add comments for all functions 2025-09-20 09:35:50 +02:00
service refactor(websocket): split controller into service + thin controller 2026-05-08 00:00:44 +02:00
session Implement CSRF protection and security hardening across the application (#4179) 2026-05-07 23:36:11 +02:00
translation Implement CSRF protection and security hardening across the application (#4179) 2026-05-07 23:36:11 +02:00
websocket ws/inbounds: realtime fixes + perf for 10k+ client inbounds (#4123) 2026-05-05 17:27:49 +02:00
web.go refactor(websocket): split controller into service + thin controller 2026-05-08 00:00:44 +02:00