Yuan Tong
8b0806bad4
feat(listener/runix): support remote UDS forwarding ( #102 )
2026-06-13 13:39:14 +08:00
ginuerzh
722dde5cfc
fix(handler/forward): split readTimeout from pipe idleTimeout to prevent 15s download abort
...
The readTimeout field (default 15s) was being applied via xnet.Pipe to both
directions of a bidirectional proxy connection. During asymmetric transfers
(e.g. HTTP file download), the direction reading from the tunnel sees no
data after the initial request is forwarded, causing SetReadDeadline to fire
after 15s and abort the entire transfer.
Fix: add a separate idleTimeout field (default 0=disabled) to the metadata
structs in both forward/local and forward/remote handlers, and switch
xnet.Pipe to use idleTimeout instead of readTimeout. The readTimeout field
now only applies to the initial protocol sniffing/handshake phase.
Also document readTimeout vs idleTimeout semantics across all 24 locations
in the x/ module where these timeouts appear:
- readTimeout: handshake sniffing deadline (handlers), upstream response
header timeout (http.Transport), or transport-level read deadline
- idleTimeout: idle read deadline per Pipe direction (0=disabled)
- ReadTimeout on Sniffer/SnifferBuilder: upstream response header/TLS
handshake read timeout during sniffing
2026-05-31 17:05:21 +08:00
ginuerzh
f8ddb193cb
refactor(handler/forward/remote): split handler into 6 focused files with 41 tests
...
Split the 339-line handler monolith and 1169-line test blob into 11 files
(5 source + 6 test) following the handler/forward/local/ pattern.
Source files: handler.go (core), forward.go (raw forwarding),
sniffing.go (SnifferBuilder + protocol dispatch), util.go (errors +
recorder + rate limit), metadata.go (config parsing).
Fixes: add sync.Mutex for hop access (race), use sentinel errors for
errors.Is compatibility, add nil-addr guard in checkRateLimit, reuse
SnifferBuilder via Build() instead of per-call construction.
2026-05-30 16:27:20 +08:00
ginuerzh
776f045896
refactor(handler/forward): extract 6 helpers from remote Handle, add 44 unit tests
...
Extract newRecorderObject, selectTarget, sniffingDial, buildSniffer,
handleSniffedProtocol, and handleRawForwarding from Handle (200→87 lines).
Move nil Router guard before sniffing for early failure. Log previously
silent sniff and pipe errors at Debug level. Apply readTimeout to Pipe.
Append :0 when target addr lacks a port. Reorder metadata fields and
add doc comments on all exported symbols.
2026-05-28 20:40:13 +08:00
ginuerzh
c7d16962ec
add service option for plugin
2025-08-29 23:36:31 +08:00
ginuerzh
b597467858
add context for conn
2025-08-04 19:29:38 +08:00
ginuerzh
f71351f5ef
add interface xnet.SrcAddr/DstAddr
2025-08-03 10:15:53 +08:00
ginuerzh
208d18125c
replace xnet.Transport by xnet.Pipe
2025-07-28 20:52:15 +08:00
ginuerzh
d9a2f44a78
add src field for logger and recorder
2025-07-02 21:35:02 +08:00
ginuerzh
06d993023f
add traffic reset for stats
2024-12-24 20:11:22 +08:00
ginuerzh
6f001a779a
tunnel: fix tunnel routing for public entrypoint
2024-11-22 22:04:44 +08:00
ginuerzh
3b4fd643de
fix udp port forwarding
2024-10-22 22:50:40 +08:00
ginuerzh
6b932e35bf
sniffing websocket frame
2024-10-19 19:36:06 +08:00
ginuerzh
618d042001
add input/ouput fields for log
2024-10-16 22:16:34 +08:00
ginuerzh
0ffed81601
add sniffer for forwarding handler
2024-10-14 21:18:38 +08:00
ginuerzh
8f994ab632
add handle options for sniffer
2024-10-10 22:49:56 +08:00
ginuerzh
c42a44abb6
add sniffer utility
2024-10-02 22:51:23 +08:00
ginuerzh
3c8add4b82
add traffic sniffing for handler
2024-09-27 15:55:28 +08:00
ginuerzh
e22aa91571
add route for recorder
2024-09-24 20:20:15 +08:00
ginuerzh
e09ec08881
add sid for connector log
2024-09-20 18:20:57 +08:00
ginuerzh
e37213ac01
add http body for handler recorder
2024-09-16 19:44:15 +08:00
ginuerzh
b39aa63f75
add clientIP for handler recorder object
2024-09-15 18:28:24 +08:00
ginuerzh
f681f7aa03
update handler recorder object
2024-09-15 10:51:23 +08:00
ginuerzh
69455ace9d
add handler recorder
2024-09-14 23:21:25 +08:00
ginuerzh
1a776dc759
fix connection state in tunnel entrypoint
2024-08-01 20:52:08 +08:00
ginuerzh
3656ba9315
add http body rewrite for forward handler
2024-07-19 20:45:04 +08:00
ginuerzh
4a4c64cc66
fix host parsing
2024-07-10 22:57:49 +08:00
ginuerzh
c1d0887a9b
add port range support for service
2024-07-08 22:38:21 +08:00
ginuerzh
25dcf536c6
added url path rewrite for forwarder node
2024-01-31 23:18:42 +08:00
ginuerzh
3d2a7b7d3b
move x/internal/ctx to x/ctx
2024-01-30 18:19:39 +08:00
ginuerzh
8bdd7ee172
added auther option for node http settings
2024-01-27 21:29:45 +08:00
ginuerzh
88cc6ff4d5
add traffic limiter for proxy handler
2023-11-18 18:28:09 +08:00
ginuerzh
6bface4581
add path option for hop
2023-11-09 20:34:59 +08:00
ginuerzh
28824885ab
add entrypoint for tunnel handler
2023-10-20 19:12:09 +08:00
ginuerzh
f2fd6554ad
get real client ip for http forwarding
2023-10-18 21:22:44 +08:00
ginuerzh
54b56df214
fix race condition
2023-10-18 19:19:43 +08:00
ginuerzh
3f3deb98b8
fix http traffic forwarding
2023-10-18 14:32:42 +08:00
ginuerzh
5d57852c8a
fix websocket for forward handler
2023-10-17 23:25:13 +08:00
ginuerzh
a9f0dda805
fix websocket for tunnel
2023-10-17 23:04:30 +08:00
ginuerzh
1759c95e78
add mux config
2023-10-17 21:55:07 +08:00
ginuerzh
bf5311ddc3
fix http handler for tunnel
2023-10-16 23:53:58 +08:00
ginuerzh
5dfbb59f8a
update forward handler
2023-10-16 23:16:47 +08:00
ginuerzh
4be7d60147
add auther for metrics
2023-10-09 21:27:35 +08:00
ginuerzh
6a36ebcc9f
add proxy protocol support for relay tunnel and rtcp
2023-10-08 19:49:03 +08:00
ginuerzh
ea585fc25d
add reload and plugin support for hop
2023-09-28 21:04:15 +08:00
ginuerzh
ddc3c9392e
add client addr for auth plugin
2023-09-21 19:59:56 +08:00
ginuerzh
1760151500
add HTTP plugin
2023-09-20 22:56:43 +08:00
ginuerzh
674a70cd23
add client ID for plugin service
2023-09-19 22:31:37 +08:00
ginuerzh
46db8480fa
add timeout for sniffing
2023-05-21 15:47:51 +08:00
ginuerzh
32c8188351
add plugin system
2023-04-18 20:52:56 +08:00