Skip to content
Edit this page

Transports and Building

Wind isolates transport engines into dedicated crates so consumers can select QUIC backends, TLS crypto providers, and Cronet linkage modes at compile time.

QUIC Backends (wind-quic / wind-tuic)

wind-quic exposes a uniform async handle abstraction over quinn and tokio-quiche. wind-tuic's protocol state machines are generic over wind_quic::QuicConnection, allowing either backend to be enabled alone or compiled side by side.

Feature Selection

Crate Default features Notes
wind-quic ["quiche"] Opt into quiche, quinn, aws-lc-rs, ring, h3
wind-tuic ["server", "client", "quinn", "quiche", "aws-lc-rs", "masquerade"] masquerade implies server and wind-quic/h3

For a Quinn-only build without BoringSSL, disable default features and pick a rustls crypto provider (aws-lc-rs or ring):

[dependencies]
wind-tuic = { version = "0.2", default-features = false, features = ["client", "quinn", "ring"] }

Quiche Build Prerequisites

Building the quiche backend compiles BoringSSL and requires:

  • Target C/C++ compiler, CMake, and libclang;
  • NASM on Windows;
  • Appropriate cross-compiler and sysroot for cross-compilation.

The workspace patches quiche, tokio-quiche, and datagram-socket to the same pinned revision of rust-proxy/quiche via [patch.crates-io] so every backend consumer receives identical portability fixes. The forks/quiche submodule serves as the reference and editing checkout.

Backend Comparison

Capability Quinn backend Quiche backend
TLS library rustls (aws-lc-rs or ring) BoringSSL
Congestion control Bbr (default, via quinn-congestions), Bbr3, Cubic, NewReno Cubic (default), Bbr / BbrV2 (26-field Bbr2gcConfig), Reno
Flow control Fixed stream/connection receive windows; initial_window, GSO, PMTU Initial & max auto-tuned receive windows, HyStart++, pacing rate caps
Certificate reload Via TlsProvider::Resolver (rustls::server::ResolvesServerCert, e.g. wind-acme) Atomic CertStore::update preserving active connections and ECH keys
ECH (Encrypted Client Hello) Unsupported (passing ech_config_list returns an error) Server CertStore::with_ech_key and strict client ech_config_list verification
0-RTT resumption Managed by rustls / quinn session cache Client captures and replays NewSessionTicket across reconnects
HTTP/3 masquerading Supported (masquerade feature) Supported (masquerade feature)

Strict ECH enforcement

When a Quiche client sets ech_config_list, the driver requires BoringSSL to confirm that ECH was accepted by the server. Rejection or unusable configs fail the handshake rather than silently downgrading to plaintext SNI or adopting server retry configs.


NaïveProxy and Cronet (wind-naive)

wind-naive wraps Chromium Cronet via cronet-rs to open HTTP/2 and HTTP/3 CONNECT tunnels.

Linkage Modes and Feature Matrix

wind CLI feature wind-naive feature Behavior
(none, default) (none, default) Runtime dynamic loading on desktop; no build-time network access
download download Build-time download of target prebuilt from rust-proxy/cronet-binaries with SHA-256 verification
naive-dynamic dynamic Explicitly select runtime dynamic loading (takes precedence over static linking on desktop)
naive-static static-link Statically embed a local Cronet archive (CRONET_LIB_DIR); no runtime shared library needed
naive-download download-static Download and verify the target static archive only when static linking is active; no-op in dynamic mode

Common Build Commands

# 1. Dynamic loading + build-time SHA-256-verified prebuilt download
cargo build --locked -p wind --features download

# 2. Static linking against a locally provided Cronet archive
CRONET_LIB_DIR=/path/to/native/lib cargo build --locked -p wind --features naive-static

# 3. Static linking + automatic prebuilt archive download
cargo build --locked -p wind --features naive-static,naive-download

Static Archive Notes

  • Pinned prebuilt static archives (Linux glibc/musl, Windows MSVC, Apple, Android) match SagerNet Chromium v154.0.8037.49 with SHA-256 verification.
  • Setting CRONET_LIB_DIR always overrides automatic downloads.
  • Linux glibc and musl require distinct native archives.
  • Windows MSVC requires cronet.lib and its paired link_flags.txt. Automatic downloads match Rust's CRT automatically: default /MD builds need no extra RUSTFLAGS, while explicit +crt-static builds select the /MT archive (pass --target as well). Custom unpinned assets require CRONET_DOWNLOAD_SHA256 (and CRONET_DOWNLOAD_LINK_FLAGS_SHA256 on Windows).

Default Dynamic Library Search Order

When cronet_lib_path is unset in dynamic mode, the loader tries candidates in order:

  1. <OUT_DIR>/libcronet-<platform>.so (only when built with --features download)
  2. libcronet.so / libcronet.dylib via system paths and LD_LIBRARY_PATH / DYLD_LIBRARY_PATH
  3. ./libcronet.so (or .dylib) in the current working directory
  4. /usr/local/lib/libcronet.so
  5. /opt/cronet/libcronet.so
  1. <executable directory>\libcronet.dll
  2. <executable directory>\cronet.dll

On Windows, the current working directory and PATH are not searched by default; pass a DLL path or directory via cronet_lib_path to override.

Library-Level Extensions

Direct callers of wind-naive gain two additional controls beyond the CLI schema:

  • host_resolver_rules: Set Cronet HostResolverRules (e.g. MAP proxy.example.com 203.0.113.7) in NaiveOutboundOpts to pin the dial IP while keeping server_name for SNI and certificate verification.
  • SocketPolicy binding: Pass a SocketPolicy and TCP connect timeout to NaiveOutbound::new_with_socket_policy to bind every TCP and QUIC socket owned by that engine (use separate outbounds for different interfaces or marks):
Platform Interface binding Routing mark
Linux SO_BINDTODEVICE by name (1–15 bytes) SO_MARK
macOS / iOS IP_BOUND_IF / IPV6_BOUND_IF by non-zero index Rejected (Linux-only)
Windows IP_UNICAST_IF / IPV6_UNICAST_IF by non-zero index Rejected (Linux-only)
Android / other Rejected Rejected

Unsupported policies return an explicit error and never fall back silently to unbound dialing.

UDP-over-TCP v2

wind-naive layers sing-box UoT v2 over a single CONNECT tunnel using Vest-generated codecs:

  • Opens one tunnel to the magic authority sp.v2.udp-over-tcp.arpa;
  • Sends a non-connect request header (0x00 + SOCKS5 address) once so a single tunnel can fan out to arbitrary destinations;
  • Frames each datagram bidirectionally as UoT address (0x00 IPv4 / 0x01 IPv6 / 0x02 Domain) ‖ u16 big-endian length ‖ payload.