Commit Graph

79 Commits

Author SHA1 Message Date
ginuerzh 5a838a7d47 fix(dtls): upgrade pion/dtls v2.2.6 to v3.1.1 fixing CVE-2026-26014
Upgrade github.com/pion/dtls from v2.2.6 to v3.1.1 to fix nonce reuse
vulnerability in AES-GCM ciphers (GHSA-9f3f-wv7r-qc8r). Migrate from
deprecated Config-struct API to ListenWithOptions/ClientWithOptions
options-based API.

v2 Config fields mapped to v3 functional options:
- Certificates, InsecureSkipVerify, ExtendedMasterSecret, ServerName,
  RootCAs, ClientCAs, ClientAuth, FlightInterval, MTU

ConnectContextMaker removed — no longer exists in v3; explicit
HandshakeContext(ctx) on *Conn is the replacement for timeout control.
2026-05-23 18:48:21 +08:00
ginuerzh 01a2bbaa11 fix(masque): address review findings for PR #76
- Return errors from MasqueConn.Read/Write instead of silently
  succeeding (prevents infinite busy-loops and silent data loss
  if these methods are accidentally called).
- Set recorder Network field in protocol dispatch switch rather
  than hardcoding "udp", so early errors don't misreport type.
- Clarify that DatagramConn context-ID handling only supports
  context ID 0 (sufficient for CONNECT-UDP per RFC 9298).
2026-05-21 22:50:29 +08:00
Andrew Beresford ac99425002 feat: extend TCP keepalive support to all TCP-based listeners and dialers
Add configurable TCP keepalive (keepalive, keepalive.idle,
keepalive.interval, keepalive.count) to all TCP-based transport types:
tls, mtls, mtcp, ws/wss, mws/mwss, http2, ssh, sshd listeners and
tls, mtls, mtcp, ws/wss, mws/mwss, ssh, sshd dialers.

For types that already use "keepalive" for an app-level protocol
(grpc listener/dialer, ws/mws dialers, ssh/sshd dialers), the TCP
keepalive parameters are exposed under the tcp.keepalive.* prefix to
avoid ambiguity.

Also extract shared helpers into internal/net/keepalive.go:
- WrapKeepaliveListener: applies KeepAliveConfig on every accepted TCPConn
- ApplyKeepalive: applies KeepAliveConfig to a single TCPConn

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 14:32:53 +01:00
Andrew Beresford cf70a0cbe1 Add configurable TCP keepalives to TCP listener and dialer
Exposes TCP keepalive configuration via listener and dialer metadata:

  keepalive: true
  keepalive.idle: 30s
  keepalive.interval: 10s
  keepalive.count: 6

When enabled, the OS sends keepalive probes after the idle period and
tears down the socket if the remote does not respond. This causes any
blocked Read() on a dead connection to return promptly, releasing
goroutines and memory — covering both legs of a CONNECT tunnel (the
inbound client connection via the listener, and the outbound upstream
connection via the dialer).

This is the correct alternative to a hard application-level read
deadline (SetReadDeadline) for detecting dead connections, as it
distinguishes truly dead connections from legitimately idle ones.

Relates to: https://github.com/go-gost/x/issues/91
2026-05-08 11:33:54 +01:00
Vasileios Papadimas 96f35bd7aa feat: add custom header support to PHT protocol
- Add Header field to PHT Client and clientConn structs
- Support custom headers in authorize, push, and pull requests
- Add metadata parsing for header configuration as map[string]string
- Enables PHT usage with header-based authentication (e.g., Cloudflare Access)

Backwards compatible - headers are optional.
2026-04-21 20:51:17 +08:00
21paradox 180145189f add SetReadDeadline in Pipe, to prevent memory not auto release in mws/mtcp 2026-04-21 20:02:32 +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 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 ad5cf6fd61 add proxyProtocol support for dialer 2025-08-03 15:36:29 +08:00
ginuerzh 3ec2f9d487 update quic 2025-06-25 21:06:23 +08:00
ginuerzh 355c72477a add router handler & connector 2025-02-07 15:44:31 +08:00
ginuerzh 06d993023f add traffic reset for stats 2024-12-24 20:11:22 +08:00
TimWhite 914a4622fd Update dialer.go 2024-12-24 17:22:13 +08:00
ginuerzh f4d9a5f79b tunnel: checking closed connector 2024-11-01 15:25:45 +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
yorks 5a19a33f51 sshd:// add read env SSH_AUTH_SOCK for ssh-agent auth 2024-08-30 20:04:56 +08:00
ginuerzh c0a80400d2 add support for icmpv6 2024-07-15 20:34:59 +08:00
ginuerzh c1d0887a9b add port range support for service 2024-07-08 22:38:21 +08:00
Wankko Ree ba2a83a51d fix QUIC error "CRYPTO_ERROR 0x178 (remote): tls: no application protocol" 2024-07-03 22:06:17 +08:00
ginuerzh 2ae0462822 add support for linux network namespace 2024-06-21 23:38:18 +08:00
ginuerzh 15f28c667a fix wt dialer 2024-06-13 22:24:50 +08:00
ginuerzh 9bae597cbb Bump deps 2024-06-13 21:53:14 +08:00
ginuerzh ce60160cd7 fix marker for selector 2024-06-07 20:57:47 +08:00
ginuerzh 41b5e62207 added ohttps dialer 2024-04-25 14:59:01 +08:00
ginuerzh 766ce7fdaa merger origin/master 2024-04-25 09:44:49 +08:00
ginuerzh c35a79b2c9 Merge branch 'master' into feature/homedir-expand-ssh 2024-04-24 23:07:38 +08:00
Christian Groschupp 6ba22b0935 feat: expand homedir of ssh private key 2024-04-16 16:43:47 +02:00
Christian Groschupp 7da8b2a710 feat: allow to read ssh passphrase from keyring 2024-04-16 16:42:50 +02:00
ginuerzh d9b7585856 add more options for kcp dialer/listener 2024-03-09 20:58:22 +08:00
ginuerzh 1117723913 fix kcp option 2023-12-25 22:08:41 +08:00
ginuerzh 40e9a8ce7b fix panic 2023-12-20 19:24:02 +08:00
ginuerzh 2c82233b4f add more config options for kcp 2023-11-16 21:42:11 +08:00
ginuerzh 696d10fc28 add webtransport tunnel 2023-11-10 21:29:11 +08:00
ginuerzh 68edeb2d59 update sd 2023-11-02 20:52:33 +08:00
ginuerzh 33adbb9027 fix mws dialer 2023-10-25 23:11:55 +08:00
ginuerzh 5b1183661f set smux version to 1 2023-10-24 20:45:19 +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 5ab729b166 fix serial 2023-10-15 23:55:52 +08:00
ginuerzh 95da26cf49 add unix/serial dialer and connector 2023-09-18 23:14:55 +08:00
Charles Xu 7833ca8bc6 replace deprecated method 2023-09-18 10:16:48 +00:00
honwen.chan a2878c3155 bump deps; bump sdk to 1.21 2023-08-22 00:02:27 +08:00
ginuerzh fb7b827ea2 fix keepalive for websocket 2023-03-21 17:58:10 +08:00
ginuerzh 661953e09f fix grpc dialer 2023-03-20 18:28:35 +08:00
ginuerzh f32b72ce56 fix grpc dialer 2023-03-07 23:51:27 +08:00
ginuerzh 7a21c7eb6f add keepalive for ssh 2023-03-03 13:06:20 +08:00
ginuerzh 02a5f4dde4 go1.20 2023-02-04 18:44:52 +08:00