Commit Graph

5 Commits

Author SHA1 Message Date
winlin
953b0d63ca Claude: Add WebRTC proxy seams and unit tests.
Introduce listenUDP and backendURL functional-option seams on
webRTCProxyServer and a dialBackendUDP seam on rtcConnection, mirroring
the pattern already used by rtmpProxyServer. The seams default to the
real net.ListenUDP / http URL builder / net.Dialer so production
behavior is unchanged, but unit tests can now inject fakes.

Cover webRTCProxyServer with focused tests: constructor defaults
(including the three default-backendURL branches), Close with no
listener, Run's listen error / endpoint normalization / graceful
shutdown, HandleApiForWHIP and HandleApiForWHEP CORS preflight, Pick
error, full happy-path against an httptest backend asserting SDP port
rewrite and StoreWebRTC wiring, proxyApiToBackend error paths
(backendURL error, non-2xx, malformed answer), and handleClientUDP's
non-STUN, RTP-like, short-STUN, cached-username, LB-load, LB-error,
and cached-address paths. internal/proxy package coverage rises from
~23% to 43.4%.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 19:21:34 -04:00
winlin
7b4c4dc999 Claude: Add RTMP proxy seams and unit tests.
Refactor internal/proxy/rtmp.go to expose functional-option seams
(listen, newConnection, newHandshake, newProtocol, newBackend, dial)
and widen the proxy server and connection to net.Listener / net.Conn
so fakes can be injected. Tighten the identify switch in serve() to
a real switch on CommandName.

Add internal/proxy/rtmp_test.go covering rtmpProxyServer (constructor
defaults, options, Close, listen error, endpoint normalization,
accept-loop, graceful shutdown), rtmpConnection (defaults, serve
handshake/protocol error paths, identify-loop branches, newBackend
invocation contract), and rtmpClientToBackend (Close, Connect happy
and error paths, publish, play). rtmp.go statement coverage rises to
76.9% with every function exercised.
2026-05-16 16:54:11 -04:00
winlin
f45bf30b46 Codex: Remove global proxy load balancer.
Create the origin load balancer in proxy bootstrap and pass it explicitly into protocol servers and system API handlers. Also keep load balancer implementations package-private and rename the default debugging origin helper.

Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
2026-05-10 21:00:17 -04:00
winlin
3b93ddfddf Codex: Rename origin load balancer types. 2026-05-10 20:43:56 -04:00
winlin
8db8f8d9b4 Proxy: Rename internal/server package to internal/proxy
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 18:09:48 -04:00