Commit Graph

69 Commits

Author SHA1 Message Date
ginuerzh 3f73c82d00 fix(ss): address review findings for PR #96 — nil guards, resource leaks, dead code
- Bump go-shadowsocks2 to v0.1.3 (new API symbols)
- Return error instead of nil when Target() is empty in TCP handler
- Reset wbuf unconditionally on write error to prevent unbounded growth
- Add nil guard on targetAddr before WriteTo to prevent panic
- Remove duplicate NewClientConfig call and dead ClientConfig literal
- Remove unused noDelay metadata field
- Fix buffer-size guard to catch negative values (len(b)==0 → bufSize<=0)
- Add address context to parse/session error messages
2026-05-22 21:40:33 +08:00
kLiHz 3c8995027a adapt newest go-shadowsocks2 lib 2026-05-22 13:35:01 +08:00
ginuerzh 66b53580af merge: PR #76 — MASQUE CONNECT-UDP and CONNECT-TCP support (RFC 9298/9114)
Extend MASQUE implementation to support TCP tunneling via standard
HTTP/3 CONNECT method, in addition to UDP via CONNECT-UDP.
2026-05-21 22:50:23 +08:00
Evsyukov Denis 802943bd28 fix(ss): propagate cipher errors and decode SIP002 base64 auth
- Return err instead of nil in SS TCP/UDP connector Init when
  NewClientConfig fails, preventing nil pointer dereference in WrapConn
- Initialize tcpClient in UDP connector for UDP-over-TCP path
- Add decodeSIP002Auth to handle ss://BASE64(method:password)@host:port
  URL format with RawURLEncoding and StdEncoding fallback
- Update buildServiceConfig and buildNodeConfig to decode SIP002 auth
  for ss* schemes before falling back to standard userinfo parsing
- Support RawURLEncoding in parseAuthFromCmd with StdEncoding fallback
- Add tests for decodeSIP002Auth, parseAuthFromCmd, and integration
  tests for buildNodeConfig/buildServiceConfig
2026-04-21 20:55:45 +08:00
David Manouchehri 7625973ca1 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)
2026-04-21 19:53:07 +08:00
RMT 6389378610 Remove usage of ShadowConn for ssHandler and ssConnector (#68)
The new ss library has integrated the function of ShadowConn.
2025-12-29 16:22:42 +08:00
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