erebe/wstunnel
50.6
Adequate · 14 November 2026
10.7k
lines of production code
Rust
primary language
5
measurements over time
What this system is
This system is a high-performance tunneling service that encapsulates various network protocols, including TCP, UDP, and SOCKS5, into secure transport layers such as WebSocket, HTTP/2, and WebTransport. It provides robust infrastructure for managing connections through features like mutual TLS authentication, dynamic restriction reloading, and encrypted DNS resolution. The tool supports both client and server roles, enabling the creation of reverse tunnels and local listeners while optimizing performance via connection pooling and modern Rust networking libraries.
How it got here
2016–2025 — WebTransport and HTTP/2 transport expansion
16 changes.
The project expanded its tunneling capabilities by introducing WebTransport and HTTP/2 as new transport protocols alongside existing WebSocket support. This period also involved significant architectural refactoring, including modularizing DNS, TLS, and restriction logic, while adding features like mTLS development infrastructure and dynamic configuration reloading.
2026 — WebTransport support and connection pooling
4 changes.
This period focused on introducing WebTransport as a new tunnel transport option, leveraging HTTP/3 over QUIC for lower latency and improved multiplexing. The work also involved implementing connection pooling for both WebTransport and TCP transports to enhance resource efficiency and reduce handshake latency. Additionally, downstream listeners were refactored into a unified trait-based architecture to standardize connection handling across protocols, and a benchmarking script was added to measure performance.
Features
Add HTTP/2 and WebTransport tunnel transport protocols
Users can now establish tunnels using HTTP/2 and WebTransport protocols in addition to the existing WebSocket support. This change introduces new transport implementations (\http2.rs\, \webtransport.rs\) and updates the core transport abstractions (\io.rs\, \types.rs\) to handle these protocols, including specific configuration for HTTP/2 headers and WebTransport over QUIC. The \TransportScheme\ enum now includes \Http\, \Https\, and \Wts\ (WebTransport) variants, allowing clients to select these newer transport methods for potentially improved performance or compatibility in restricted network environments.
wstunnel/src/tunnel/transport · high confidence
Add WebTransport (HTTP/3 over QUIC) tunnel transport
Users can now establish tunnels using the WebTransport protocol, which leverages HTTP/3 over QUIC for lower latency and improved multiplexing compared to existing WebSocket or HTTP/2 transports. This new transport module includes a dedicated client implementation that manages QUIC endpoints, handles session pooling, and supports dynamic reverse tunnels via JWT-based stream preambles. It also features optimized read/write paths using vectored I/O and buffer pooling to improve throughput, along with specific fixes for IPv4/IPv6 compatibility on BSD operating systems.
wstunnel/src/tunnel/transport/webtransport · high confidence
Added benchmarking script for wstunnel transports
A new \scripts/bench.sh\ script has been added to allow users to benchmark wstunnel transport performance end-to-end. The script supports measuring throughput, CPU usage, and memory consumption across various transports (wts, wss, ws, https, http) using iperf3, and includes options for profiling with perf and dhat-heap.
scripts · high confidence
Added mTLS development certificate infrastructure
The repository now includes a complete set of mTLS (mutual TLS) certificates and configuration files for local development under \certs/mTLS\. This addition provides a self-signed Root CA, along with corresponding server and client certificates and private keys, enabling secure, mutually authenticated WebSocket tunneling during development without requiring external certificate authorities.
certs · high confidence
Initial project scaffolding and build configuration
This change establishes the foundational repository structure for the wstunnel project, introducing essential build and release tooling. It adds a multi-stage Dockerfile for containerized builds, a .goreleaser.yaml configuration to manage binary releases across multiple operating systems and architectures (including Linux, macOS, Windows, FreeBSD, and Android), and a helper script to map Go build targets to Rust artifacts. Additionally, it provides developer convenience files such as a justfile and mise.toml for running tests and linters, configuration files for Rust formatting (rustfmt.toml) and TOML linting (taplo.toml), and documentation files including CONTRIBUTING.md, SECURITY.md, and a comprehensive README.md detailing usage, command-line options, and supported protocols.
(repo-wide) · high confidence
Introduce UDP protocol support
Adds a new UDP protocol implementation to wstunnel, exposing types like UdpStream and UdpStreamWriter along with server-side logic for handling UDP connections. This enables users to tunnel UDP traffic over WebSocket connections, expanding the tunnel's capabilities beyond TCP.
wstunnel/src/protocols/udp · high confidence
Introduce connection pooling for WebTransport and TCP transports
The client now uses a pooled connection model for both WebTransport (wts://) and standard TCP-based transports (ws, wss, http, https). A new \L4StreamManager\ manages the lifecycle of these connections, establishing WebTransport sessions via QUIC/HTTP-3 or TCP/TLS streams as needed. This allows multiple tunnels to share a single underlying connection, improving resource efficiency and reducing handshake latency for subsequent tunnel requests.
_wstunnel/src/tunnel/client/connection\pool · high confidence
Introduction of WebTransport support in the client tunnel implementation
The client module now supports the WebTransport protocol (Wts scheme) in addition to existing WebSocket and HTTP/2 transports. The \Client\ struct manages connections via a pooled \L4StreamManager\ and routes traffic through \TransportReader\/\TransportWriter\ wrappers that handle WebTransport-specific logic, including UDP packet boundary preservation. Configuration is extended with a \webtransport\ field in \ClientConfig\ to hold the QUIC endpoint, enabling users to establish tunnels over WebTransport.
wstunnel/src/tunnel/client · high confidence
Introduction of a new DNS resolver module with DoH/DoT support
A new \wstunnel/src/protocols/dns\ module has been added, introducing a \DnsResolver\ abstraction that allows users to configure custom DNS resolvers via URLs. This change enables DNS over HTTPS (\dns+https\) and DNS over TLS (\dns+tls\) by parsing resolver URLs, extracting SNI parameters, and configuring the underlying \hickory\_resolver\ library. The module also includes logic to sort IPv4/IPv6 addresses according to RFC8305 and handles platform-specific optimizations, such as cache size adjustments for Windows. This provides users with greater control over DNS resolution, particularly in environments requiring encrypted DNS queries or specific resolver configurations.
wstunnel/src/protocols/dns · high confidence
New TCP protocol implementation with dual-stack connection handling
A new TCP protocol module has been introduced, providing the core networking logic for establishing TCP connections. This implementation supports dual-stack connectivity (IPv4 and IPv6) by attempting connections to all resolved addresses concurrently, with staggered delays as per RFC8305 to optimize connection times. It includes configurable socket options such as TCP\_NODELAY, platform-specific TCP keepalive settings, and SO\_MARK support for traffic marking. Additionally, it features an HTTP proxy connector that handles CONNECT requests, including Basic authentication for proxies requiring credentials.
wstunnel/src/protocols/tcp · high confidence
New WebTransport server handler and HTTP/2 upgrade support
The server now supports WebTransport (HTTP/3 over QUIC) as a transport protocol, allowing clients to establish tunnels over UDP with mandatory TLS 1.3. This is implemented via a new \handler\_webtransport.rs\ module that manages QUIC endpoints, certificate reloading, and session handling. Additionally, a new \handler\_http2.rs\ module has been added to handle HTTP/2 server upgrades, enabling tunneling over HTTP/2 connections alongside the existing WebSocket support. The server module (\mod.rs\) now exports these new handlers, and the main \server.rs\ integrates them into the request handling flow.
wstunnel/src/tunnel/server · high confidence
Behavioural changes
Automatic reloading of TLS certificates and system CA certificates
The tunnel module now automatically detects and reloads TLS certificates and private keys when they change on disk, ensuring that certificate renewals (including those that replace files via symlinks) are applied without restarting the service. Additionally, system CA certificates are periodically reloaded in the background to keep the trusted root store up to date.
wstunnel/src/tunnel · high confidence
HTTP proxy now supports authentication and non-CONNECT requests
The HTTP proxy implementation has been updated to handle authentication for regular HTTP requests, not just CONNECT tunnels. Users can now configure credentials (username/password) which are validated via the Proxy-Authorization header for both standard HTTP methods and CONNECT requests. Additionally, the proxy now supports non-HTTP CONNECT methods for non-TLS connections, allowing it to forward regular HTTP traffic directly rather than requiring a tunnel setup for all requests.
_wstunnel/src/protocols/http\proxy · high confidence
New CLI entry point with configurable runtime and logging
The wstunnel-cli now features a new main.rs entry point that allows users to configure the number of Tokio worker threads via the --nb-worker-threads flag (or TOKIO\_WORKER\_THREADS env var), disable colored log output with --no-color (or NO\_COLOR env var), and adjust log verbosity via --log-lvl (or RUST\_LOG env var). The CLI also integrates a system CA certificate reloader and optionally uses Jemalloc for memory allocation when the jemalloc feature is enabled.
wstunnel-cli · high confidence
Refactored downstream listeners to use a unified trait-based architecture
The downstream listener implementations for TCP, UDP, HTTP proxy, SOCKS5, stdio, and Unix sockets have been refactored to implement a new \DownstreamListener\ trait with explicit \DownstreamRead\ and \DownstreamWrite\ interfaces. This change standardizes how local connections are exposed to the tunnel core, ensuring consistent handling of connection streams and remote address metadata across all supported protocols. The refactoring also introduces a \DownstreamWrite\ trait that allows specific protocols (like SOCKS5) to defer connection acknowledgments until the tunnel is confirmed ready, while others use a no-op default.
_wstunnel/src/tunnel/downstream\listeners · high confidence
Restrictions module refactored to support dynamic config reloading and explicit reverse tunnel rules
The restrictions logic has been restructured into a dedicated module with a new \RestrictionsRulesReloader\ that watches a configuration file for changes and automatically reloads rules without restarting the service. The underlying data types now explicitly define separate allow configurations for standard tunnels and reverse tunnels, introducing specific fields for reverse tunnel constraints such as \unix\_path\ and \port\_mapping\. This change enables more granular control over reverse tunnel access, including the ability to restrict connections by Unix socket path, while maintaining the existing capability to reload restriction rules dynamically via file system events.
wstunnel/src/restrictions · high confidence
SOCKS5 server now waits for tunnel establishment before responding to clients
The SOCKS5 implementation in wstunnel has been refactored to ensure that TCP connections are not acknowledged to the client until the underlying tunnel is confirmed to be established. Previously, the server might have replied to the SOCKS5 handshake before knowing if the remote tunnel could be created; now, the write half holds the connection state (\TcpPending\) and only sends the success or error reply via \on\_tunnel\_ready\ once the tunnel outcome is known. This prevents clients from attempting to send data over a tunnel that has already failed to initialize. Additionally, a 10-second timeout is enforced on the initial SOCKS5 handshake to prevent idle clients from blocking the accept loop.
wstunnel/src/protocols/socks5 · high confidence
TLS configuration logic is reorganized into a dedicated module
The TLS connection and server configuration logic has been extracted from the existing protocol implementation into a new, dedicated \wstunnel/src/protocols/tls\ module. This change introduces a \server.rs\ file that centralizes the creation of TLS connectors and acceptors, including support for mTLS, ECH (Encrypted Client Hello), and QUIC-specific TLS 1.3 configurations, alongside a \utils.rs\ file for certificate parsing utilities. This reorganization improves code clarity and maintainability by isolating TLS-specific concerns from the broader tunneling logic.
wstunnel/src/protocols/tls · high confidence
wstunnel library restructured with new transport and protocol support
The wstunnel source code has been reorganized into a modular library structure, introducing a new WebTransport (WTS) transport protocol alongside existing WebSocket and HTTP transports. This update adds support for reverse Unix-domain tunnels, allows restricting reverse tunnels, and improves Socks5 client handling by waiting for tunnel establishment. Configuration options now include ECH (Encrypted Client Hello) support, HTTP upgrade path customization, and self-signed certificate validity extended to 2027. The executor trait has been refactored for better performance, and the library exposes public types like HeaderName and HeaderValue for easier integration.
wstunnel/src · high confidence
Dependencies
Upgrade to Rust 2024 edition and Hyper 1.x
The project has been updated to use the Rust 2024 edition and upgraded to Hyper 1.x (specifically hyper 1.11.1 and hyper-util 0.1.20). This change affects the underlying HTTP handling and requires a corresponding update to the Cargo.lock file to resolve the new dependency tree.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 53 → 51 (-2.4)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 71 → 65 (-5.3)
- Architecture 88 → 88 (+0.0)
- Maturity 59 → 59 (+0.0)
- Readiness 61 → 60 (-0.7)
- Security 39 → 35 (-4.1)
- Performance 100 → 100 (+0.0)
Resolved (8)
- Duplicated block (10 lines × 4) (wstunnel/src/tunnel/server/server.rs)
- Duplicated block (11 lines × 2) (wstunnel/src/tunnel/server/server.rs)
- Duplicated block (12 lines × 2) (wstunnel/src/protocols/socks5/udp_server.rs)
- Duplicated block (8 lines × 2) (wstunnel/src/protocols/socks5/udp_server.rs)
- Duplicated block (8 lines × 2) (wstunnel/src/protocols/tcp/server.rs)
- Edited copy of a member (42 corresponding lines) (wstunnel/src/protocols/socks5/udp_server.rs)
- Medium vulnerability: [GHSA redacted] (Cargo.lock)
- No ADRs found
New (50)
- Duplicated block (10 lines × 4) (wstunnel/src/tunnel/server/server.rs)
- Duplicated block (11 lines × 2) (wstunnel/src/tunnel/server/server.rs)
- Duplicated block (12 lines × 2) (wstunnel/src/protocols/socks5/udp_server.rs)
- Duplicated block (13 lines × 2) (wstunnel/src/restrictions/config_reloader.rs)
- Duplicated block (15 lines × 2) (wstunnel/src/protocols/socks5/udp_server.rs)
- Edited copies of one member (4 members, 7+ corresponding lines) (wstunnel/src/protocols/socks5/tcp_server.rs)
- Edited copies of one member (4 members, 7+ corresponding lines) (wstunnel/src/tunnel/client/connection_pool/l4_stream.rs)
- Edited copies of one member (5 members, 21+ corresponding lines) (wstunnel/src/tunnel/downstream_listeners/tcp.rs)
- Edited copy of a member (10 corresponding lines) (wstunnel/src/tunnel/upstream_connectors/tcp.rs)
- Edited copy of a member (13 corresponding lines) (wstunnel/src/tunnel/downstream_listeners/http_proxy.rs)
- Edited copy of a member (14 corresponding lines) (wstunnel/src/tunnel/transport/http2.rs)
- Edited copy of a member (19 corresponding lines) (wstunnel/src/tunnel/server/utils.rs)
- Edited copy of a member (29 corresponding lines) (wstunnel/src/protocols/tls/server.rs)
- Edited copy of a member (31 corresponding lines) (wstunnel/src/tunnel/tls_reloader.rs)
- Edited copy of a member (32 corresponding lines) (wstunnel/src/restrictions/config_reloader.rs)
- Edited copy of a member (33 corresponding lines) (wstunnel/src/tunnel/tls_reloader.rs)
- Edited copy of a member (7 corresponding lines) (wstunnel/src/tunnel/tls_reloader.rs)
- Edited copy of a member (79 corresponding lines) (wstunnel/src/protocols/tcp/server.rs)
- Edited copy of a member (9 corresponding lines) (wstunnel/src/tunnel/transport/types.rs)
- Low coverage: wstunnel-cli/src/main.rs (wstunnel-cli/src/main.rs)
- …and 30 more
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
erebe/wstunnel was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 14 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit adc9e7dd99a67a817034240626d2ffdbb160397a — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-e1a3b69fc8ee.