refactor(forwarder): split sniffer monolith into focused files, extract testable helpers

Split ~1250-line sniffer.go into sniffer_http.go (HTTP handling, dial, round-trip),
sniffer_tls.go (TLS MITM, termination), sniffer_h2.go (HTTP/2), sniffer_ws.go
(WebSocket frame copy/record), and sniffer_rewrite.go (upgrade, body rewrite).

Extract clampBodySize, normalizeHost, effectiveReadTimeout as package-level
functions to simplify testing. Add 22 tests covering pure functions, option
setters, HTTP proxy integration, WebSocket frame copy, and edge cases.
This commit is contained in:
ginuerzh
2026-05-26 22:48:27 +08:00
parent 92564a0c8c
commit aba7e2a256
7 changed files with 1930 additions and 1116 deletions
File diff suppressed because it is too large Load Diff