What's Changed
Security
- Fix KCP packet reflection and replay vulnerability (protocol v3). Introduce separate encryption keys for each traffic direction, derive per-client keys using the client ID and a fresh client nonce, and add packet-number-based replay protection. Reflected and replayed packets are now rejected. (#53)
- Prevent proxy authentication reflection attacks. Harden authentication in attachable mode by reserving the server ID, validating client IDs, and rejecting reflected or conflicting authentication acknowledgements. (#57)
- Prevent stale NAT endpoint reuse. Expire authenticated client paths when valid KCP/QUIC stream heartbeats stop arriving, preventing a new owner of a reused UDP endpoint from inheriting the previous client's authentication.
KCP security note: The protocol v3 security improvements take effect only when both
tsshandtsshdare upgraded. Older clients remain compatible but continue using the legacy shared-key protection.
New Features
- Dual-stack IPv4/IPv6 support.
tsshdnow listens on all available local IPv4 and IPv6 addresses by default. Use-4or-6to restrict the address family. Unless explicitly restricted,tsshraces IPv4 and IPv6 connections and uses the first successfully authenticated path, including during reconnections. (#52) - Zstandard compression for session output. Added
UdpCompressionsupport. Zstd compression is enabled by default when supported by the server. SetUdpCompression noneto disable it. (#49) - Optional reconnect control. Added
ShouldPauseReconnecttoUdpClientOptions, allowing applications to temporarily pause automatic reconnection attempts and provide a reason. - Colored terminal session previews. Preserve ANSI colors and text styling in terminal previews when attaching to an existing session.
Performance Improvements
- Improve session output forwarding throughput. Wake the output forwarder as soon as the stream writer frees the write queue instead of relying on fixed 10 ms polling intervals. This also improves flushing cached output after reconnection. (#56)
- Optimize proxy client address handling by caching client ID strings and avoiding repeated client map lookups.
Reliability Improvements
- Bound UDP client startup time. Apply a single
ConnectTimeoutdeadline across transport establishment, protocol initialization, bus setup, and stream handshakes. Propagate cancellation through dialing and packet writes, and clean up transports and rekey resources on failure. (#51) - Improve forwarding resource cleanup. Scope cleanup to the owning listener and session lifetimes. Ensure pending UDP forwarding sessions and blocked writes are properly canceled and resources are released when their owners close.
- Fix server shutdown races during bus initialization. Prevent nil pointer dereferences and races between bus initialization, server activation, and shutdown. Reject operations on closed servers and safely clean up streams opened before bus initialization. (#55)
- Fix timeout detection being delayed indefinitely by system clock jumps.
- Initialize KCP cryptographic state before packet readers start, preventing a startup race. Expand race-detector testing across platforms. (#50)
- Improve handling of stale client paths and pending forwarding sessions during reconnects and shutdown.
Other Fixes
- Fix ProxyCommand pipe handling to avoid blocked pipes and ensure proper EOF handling. Strip ANSI escape sequences from ProxyCommand stderr before logging.
- Ignore stale terminal resize events when the corresponding session has already exited.
- Avoid reporting rekey failures when the client is already closed.
- Initialize new session exit codes to
-1until an actual exit status is received.
New Contributors
- @soupdiver made their first contribution in #49
Full Changelog: v0.1.10...v0.1.11