dd402d4fc4
Listener on 127.0.0.1 accepts NAT-rewritten Discord SYNs (rewrite done by divert layer in Task 10), looks up the original destination in a sync-protected map keyed by source port, opens a SOCKS5 CONNECT to the upstream proxy targeting that destination, and pumps bytes both directions until either side closes. 30-minute TTL sweeper handles T-6 in the edge case matrix (mapping leak when a flow never properly closes). Pump teardown: when one direction's io.Copy exits, the goroutine CloseWrite's its write side AND sets a past read deadline on the OTHER conn so the peer goroutine's blocked read unwinds promptly even when the upstream half never sends EOF (test fake-SOCKS5 hits this; the real upstream may too). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>