mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-11-17 23:32:30 +08:00
- Introduce internal/wstunnel implementing a multi-tenant, many-to-many opaque WebSocket data exchange hub over GET /v1/tunnel. - Enforce strict access.api-keys authentication across all five standard credential sources, rejecting unconfigured keys with 401, isolating tenants per API key, and revoking removed keys on hot reload with WebSocket close code 1008. - Enforce per-tenant cross-role device UUID uniqueness (409 Conflict on duplicates, generation-bound handshake reservations) while allowing duplicate human-readable device names. - Multiplex discovery and data exchange over a single WebSocket per device: UTF-8 JSON TextMessage control frames (*ojson.Doc single-exit serialization for server_list, server_online, server_offline, list_servers, and error) and BinaryMessage frames carrying a 4-byte header, source/destination UUIDs, and up to 64 MiB opaque payloads with anti-spoofing and cross-role routing checks. - Guard upgraded transports against post-upgrade socket deadlines (including wrapped non-ALPN TLS connections and RFC 6455 protocol error paths), enforce per-peer and per-tenant outbound byte budgets retained across in-flight writes, and bound non-blocking close reclamation. - Mount /v1/tunnel on internal/api.Server (405 Allow: GET for non-GET methods while preserving CORS OPTIONS) and add English and Chinese integration guides under docs/websocket-tunnel.md and docs/websocket-tunnel_CN.md.