Commit Graph

63 Commits

Author SHA1 Message Date
David Manouchehri c5f91232cb Add TCP CONNECT support to MASQUE (RFC 9114)
Extend MASQUE implementation to support TCP tunneling via standard HTTP/3
CONNECT method, in addition to existing UDP support via CONNECT-UDP:

- Add StreamConn type for TCP data transfer over HTTP/3 stream body
- Update handler to dispatch based on :protocol pseudo-header:
  - "connect-udp" for UDP (RFC 9298)
  - Empty/"HTTP/3.0" for TCP (RFC 9114)
- Add handleConnectTCP() using bidirectional stream relay
- Update connector to support both TCP and UDP networks
- Add connectTCP() for standard CONNECT requests

TCP uses :authority for target address and stream body for data.
UDP uses path template and HTTP/3 datagrams for data.
2025-12-28 23:47:51 +00:00
David Manouchehri 1752b29df9 Add MASQUE/CONNECT-UDP support (RFC 9298)
Implement UDP tunneling over HTTP/3 using HTTP Datagrams (RFC 9297):
- Add masque handler for server-side CONNECT-UDP
- Add masque connector and h3-masque dialer for client-side
- Add enableDatagrams option to HTTP/3 listener
- Add shared utilities for datagram connections and path parsing

Resource management and connection caching:
- Add deferred stream cleanup in connector on error paths
- Add IsClosed() and Close() methods to Client for proper session management
- Clean up stale cached clients in dialer before reuse
- Close underlying stream when DatagramConn is closed
- Move RequestStream opening from connector to dialer to enable dead
  connection detection and cache invalidation (follows QUIC dialer pattern)
2025-12-28 22:16:54 +00:00
RMT 0c97db3c05 Adapt new shadowsocks library.
1. Modify ss/ssu handler and connector
2. Add users to metadata of ss and ssu handler
2025-11-11 12:37:33 +08:00
ginuerzh 404aaae5f1 without cancel the context 2025-08-05 20:24:00 +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 db21de831a fix xnet.Pipe 2025-08-01 23:00:50 +08:00
ginuerzh a5309eee97 add buffer size option for udp connection 2025-07-30 21:40:53 +08:00
ginuerzh afcf4a5252 parse real client IP 2025-07-15 19:59:10 +08:00
ginuerzh e0915affda use fixed buffer size 2025-02-18 17:38:27 +08:00
ginuerzh ef440e8b4a router: router.id is optional 2025-02-11 20:54:52 +08:00
ginuerzh 08ad260606 add entrypoint for router handler 2025-02-08 23:07:54 +08:00
ginuerzh 355c72477a add router handler & connector 2025-02-07 15:44:31 +08:00
ginuerzh 79b6b9138e add limiterRefreshInterval option for limiter 2024-11-14 20:16:09 +08:00
ginuerzh 24547b4332 add ClientAddr for websocket conn 2024-10-16 20:46:45 +08:00
ginuerzh 8f994ab632 add handle options for sniffer 2024-10-10 22:49:56 +08:00
ginuerzh e09ec08881 add sid for connector log 2024-09-20 18:20:57 +08:00
ginuerzh 22e522e933 fix udp connection timeout 2024-08-06 18:33:29 +08:00
ginuerzh c1d0887a9b add port range support for service 2024-07-08 22:38:21 +08:00
ginuerzh 96f4d7bf5c netns: fix network namespaces for listeners 2024-07-08 10:59:32 +08:00
ginuerzh f9bfca76ed fix netns for socks5 and relay handler 2024-06-24 21:18:04 +08:00
ginuerzh 3d2a7b7d3b move x/internal/ctx to x/ctx 2024-01-30 18:19:39 +08:00
ginuerzh 3616a0d8a4 fix tunnel weight 2024-01-28 18:33:54 +08:00
ginuerzh b5b39de62c add weight for tunnel connector 2024-01-27 23:31:23 +08:00
ginuerzh 88cc6ff4d5 add traffic limiter for proxy handler 2023-11-18 18:28:09 +08:00
ginuerzh f5a20fd0fc remove nodelay option for tunnel 2023-11-16 20:36:17 +08:00
ginuerzh 9584bdbf4c rm tunnel from relay 2023-11-14 22:35:46 +08:00
ginuerzh a7166b8206 add sd for tunnel 2023-10-31 22:59:14 +08:00
ginuerzh 5b1183661f set smux version to 1 2023-10-24 20:45:19 +08:00
ginuerzh 95ae6e3f57 generate random tunnel id 2023-10-20 23:54:45 +08:00
ginuerzh cc4310106b fix race condition 2023-10-19 23:47:47 +08:00
ginuerzh 0a565120df default to smux version 2 for tunnel 2023-10-17 22:15:23 +08:00
ginuerzh 1759c95e78 add mux config 2023-10-17 21:55:07 +08:00
ginuerzh 5dfbb59f8a update forward handler 2023-10-16 23:16:47 +08:00
ginuerzh 497915f465 add tunnel handler and connector 2023-10-15 15:39:25 +08:00
ginuerzh 6a36ebcc9f add proxy protocol support for relay tunnel and rtcp 2023-10-08 19:49:03 +08:00
ginuerzh 07db20c9a8 fix socks5 connector 2023-10-04 16:34:17 +08:00
ginuerzh 674a70cd23 add client ID for plugin service 2023-09-19 22:31:37 +08:00
ginuerzh 95da26cf49 add unix/serial dialer and connector 2023-09-18 23:14:55 +08:00
ginuerzh 92db078642 add network feature for relay 2023-09-16 21:47:40 +08:00
ginuerzh 6f9f5ce6ab relay: add direct routing for tunnel 2023-02-06 21:16:56 +08:00
ginuerzh 416405b1f0 add UDP support for reverse proxy tunnel 2023-02-02 19:18:10 +08:00
ginuerzh 1c6bc9283e forward non-HTTP traffic based on host 2023-01-30 21:09:21 +08:00
ginuerzh 24037aba7b relay: added private tunnel 2023-01-29 11:55:26 +08:00
ginuerzh 82cd924c86 add tunnel feature for relay 2023-01-14 13:15:15 +08:00
ginuerzh 82fff4976a fix direct dialer 2022-11-29 09:45:51 +08:00
VanyM dbae70232c change socks5 client to add tls auth method if auth configured 2022-11-27 19:49:58 +08:00
VanyM d76ded14f2 change socks5 client to provide userpass auth method only if auth configured 2022-11-27 19:49:58 +08:00
ginuerzh 91c12882f5 add conn limiter 2022-09-14 00:15:19 +08:00
ginuerzh 999707db19 add direct dialer and connector 2022-09-08 22:41:04 +08:00