ginuerzh
3646c23398
refactor(forwarder): extract resolveHTTPNode and resolveTLSNode helpers, add tests
...
Pull node-resolution logic out of dial/dialTLS into pure resolveHTTPNode
and resolveTLSNode helpers. This separates node selection (bypass, hop,
fallback) from connection establishment, making both independently
testable. Add 21 new tests covering bypass, hop selection, nil-hop,
addr fallback, upgrade response type mismatch, websocket frames,
response body rewriting, and h2 preface validation.
2026-05-26 23:15:15 +08:00
ginuerzh
aba7e2a256
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.
2026-05-26 22:48:27 +08:00
ginuerzh
92564a0c8c
fix(forwarder): ReadTimeout race, goroutine leak, PeerCertificates panic, stale error return
...
- Use local readTimeout copy in HandleOptions instead of mutating shared
Sniffer.ReadTimeout, eliminating a data race under concurrent calls
- Close both connections in sniffingWebsocketFrame when one direction
errors, preventing indefinite goroutine blockage
- Add bounds check on PeerCertificates before indexing in terminateTLS
- Discard non-fatal ParseServerHello error instead of returning it after
successful xnet.Pipe
- Log res.Write errors in bypass/bad-gateway/connect-failure paths
- Add doc comments to all 15 exported symbols
2026-05-26 21:58:30 +08:00
ginuerzh
e2072399dd
fix sniffing for websocket
2025-09-04 21:30:49 +08:00
ginuerzh
c7d16962ec
add service option for plugin
2025-08-29 23:36:31 +08:00
ginuerzh
52289bea6c
add network param for sniffing
2025-08-13 21:25:35 +08:00
ginuerzh
589c185053
forwarder: connect to sni host for empty node
2025-08-09 12:43:09 +08:00
ginuerzh
b597467858
add context for conn
2025-08-04 19:29:38 +08:00
ginuerzh
db21de831a
fix xnet.Pipe
2025-08-01 23:00:50 +08:00
ginuerzh
208d18125c
replace xnet.Transport by xnet.Pipe
2025-07-28 20:52:15 +08:00
ginuerzh
35a049fb03
rename vtun to tungo
2025-07-26 16:17:04 +08:00
ginuerzh
d9a2f44a78
add src field for logger and recorder
2025-07-02 21:35:02 +08:00
ginuerzh
d819fd3041
support http-100 continue for sniffer
2025-06-24 21:15:38 +08:00
ginuerzh
06d993023f
add traffic reset for stats
2024-12-24 20:11:22 +08:00
ginuerzh
2693ba61c4
forwarder: fix ip matcher for tls
2024-12-18 19:05:19 +08:00
ginuerzh
2e8a5d6f51
fix http keepalive for forwarding
2024-11-17 16:16:20 +08:00
ginuerzh
c2aedbabd9
add routing rule for node
2024-11-15 20:28:47 +08:00
ginuerzh
3db20563d2
add custom http response header for reverse proxy
2024-11-07 11:04:42 +08:00
ginuerzh
a12870e766
add compression flag option for http request
2024-11-02 20:41:23 +08:00
ginuerzh
88ba01b3dd
add redirect for handler recorder object
2024-10-31 19:14:21 +08:00
ginuerzh
a97ac1f30a
fix http body recorder
2024-10-22 22:51:33 +08:00
ginuerzh
3ca253537b
fix race condition for sniffing
2024-10-20 19:19:16 +08:00
ginuerzh
41f527aa46
sniffing: full websocket frame recording
2024-10-19 20:40:07 +08:00
ginuerzh
6b932e35bf
sniffing websocket frame
2024-10-19 19:36:06 +08:00
ginuerzh
7e51404ae5
fix handler sniffing
2024-10-16 23:01:12 +08:00
ginuerzh
51ca9f620a
add transport for tunnel entrypoint
2024-10-15 18:47:36 +08:00
ginuerzh
5bba004324
add keepalive option for tunnel entrypoint
2024-10-14 23:09:07 +08:00
ginuerzh
0ffed81601
add sniffer for forwarding handler
2024-10-14 21:18:38 +08:00