srs/internal
winlin f42921d7b1 Claude: Add SRT proxy seams and unit tests.
Mirror the listener and backend dial seams already in place on rtc.go so
the SRT proxy is unit-testable without binding real UDP sockets:
- srsSRTProxyServer.listener: *net.UDPConn -> net.PacketConn, with a
  new listenUDP factory injected via functional option.
- SRTConnection.backendUDP: *net.UDPConn -> io.ReadWriteCloser, with a
  new dialBackendUDP factory; connectBackend uses it instead of
  building a net.UDPAddr and calling net.DialUDP directly.
- handleClientUDP / HandlePacket / handleHandshake take net.Addr
  instead of *net.UDPAddr; writes go through PacketConn.WriteTo.
- Fix a latent SA4001: v.handshake3 = &*handshake3p was no copy at
  all, so the subsequent SynCookie rewrite mutated the just-decoded
  backend packet. Replace with an explicit value copy.

Adds internal/proxy/srt_test.go covering SRTHandshakePacket marshal
roundtrip and stream-id parsing (100%), SRTConnection handshake-0,
handshake-2 full replay, and connectBackend error paths, plus
srsSRTProxyServer constructor/lifecycle and handleClientUDP routing.
Reuses fakeBackendUDP / fakePacketConn / blockingUDPListener from
rtc_test.go for consistency.

Verified with proxy-utest.sh and the full proxy-e2e suite (rtmp,
cluster, redis, transmux, srt, whip).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 20:30:22 -04:00
..
bootstrap Claude: Split lb interfaces, extract redisclient, drop race-prone globals. 2026-05-16 11:11:18 -04:00
debug Proxy: Refine logger and environment APIs. v7.0.146 (#4670) 2026-04-28 07:18:45 -04:00
env Proxy: Refine logger and environment APIs. v7.0.146 (#4670) 2026-04-28 07:18:45 -04:00
errors Proxy: Modernize internal packages on stdlib and add unit tests. v7.0.145 (#4667) 2026-04-23 07:25:48 -04:00
lb Claude: Split lb interfaces, extract redisclient, drop race-prone globals. 2026-05-16 11:11:18 -04:00
logger Proxy: Refine logger and environment APIs. v7.0.146 (#4670) 2026-04-28 07:18:45 -04:00
proxy Claude: Add SRT proxy seams and unit tests. 2026-05-16 20:30:22 -04:00
redisclient Claude: Split lb interfaces, extract redisclient, drop race-prone globals. 2026-05-16 11:11:18 -04:00
rtmp Claude: Split lb interfaces, extract redisclient, drop race-prone globals. 2026-05-16 11:11:18 -04:00
signal Claude: Split lb interfaces, extract redisclient, drop race-prone globals. 2026-05-16 11:11:18 -04:00
sync Proxy: Modernize internal packages on stdlib and add unit tests. v7.0.145 (#4667) 2026-04-23 07:25:48 -04:00
utils Proxy: Refine logger and environment APIs. v7.0.146 (#4670) 2026-04-28 07:18:45 -04:00
version Proxy: Refactor server APIs and expand RTMP test coverage. v7.0.147 (#4672) 2026-05-02 09:36:55 -04:00