Wind is a modular proxy framework and CLI written in Rust (Edition 2024). It provides shared transport, protocol, routing, DNS, GeoData, and ACME building blocks for proxy applications such as TUIC.
Documentation (中文) · Documentation (EN) · Runtime State Machines · Formal Verification
Wind is organized as a layered Cargo workspace:
| Crate | Kind | Responsibility |
|---|---|---|
wind |
bin / lib | CLI entry point, configuration parsing and resolution, logging, and plugin wiring |
wind-core |
lib | Core App, Dispatcher, FlowContext, inbound/outbound traits, TCP/UDP relay, hooks, and graceful shutdown |
wind-base |
lib | Reusable primitives: direct, lazy, load-balanced, loopback, resolved outbounds, and TCP/UDP tunnel inbounds |
wind-rule |
lib | Leaf crate for routing rule types, parsing, and matching (no internal Wind dependencies) |
wind-acl |
lib | nftables-shaped ACL syntax, typed IR, compiler optimizations, and routing engine |
wind-geodata |
lib | GeoSite/GeoIP decoding, rkyv zero-copy mmap snapshots, and query engine |
wind-dns |
lib | DNS configuration and Hickory-based resolver integration |
wind-socks |
lib | HTTP/1, SOCKS4/4a, SOCKS5, and mixed inbound listeners plus SOCKS5 TCP/UDP outbound |
wind-quic |
lib | Backend-agnostic QUIC traits and quinn / quiche adapters, plus an HTTP/3 server surface |
wind-tuic |
lib | TUIC v5 server and client implementations with quinn / quiche providers and HTTP/3 masquerade |
wind-naive |
lib | Chromium Cronet-backed NaiveProxy outbound with UDP-over-TCP v2 (details) |
wind-acme |
lib | ACME resolvers, file-backed HTTP-01 provisioning/renewal, and self-signed certificate support |
wind-test |
lib | Shared cross-crate integration tests and benchmarks |
Two Git submodules live under forks/ as reference and editing checkouts for upstream forks:
forks/quiche: patchedrust-proxy/quichesupplying the workspace[patch.crates-io]entries forquiche,tokio-quiche, anddatagram-socket.forks/rustls-acme: forkedrustls-acmeconsumed via a pinned Git dependency.
Generate a starter configuration in YAML (default) or TOML and run wind:
cargo run -p wind -- init --format toml
cargo run -p wind -- -c config.tomlUseful CLI flags:
-c, -f, --config <PATH>: load a.toml,.yaml, or.ymlconfiguration file.-C, -d, --config-dir <PATH>: search forconfig.tomlandconfig.yamlin a directory.-D, --work-dir <PATH>: change working directory before resolving relative paths.-l, --log-level <LEVEL>: set log verbosity (trace,debug,info,warn,error; defaultinfo).WIND_*environment variables override file values via Figment. Unknown keys are rejected (deny_unknown_fields), and TLS certificate verification is enabled by default (skip_cert_verify = false).
Inbound type |
Behavior |
|---|---|
http |
HTTP/1 absolute-form requests and CONNECT tunnels |
socks |
SOCKS4/4a CONNECT, SOCKS5 CONNECT, and SOCKS5 UDP ASSOCIATE (when allow_udp is enabled) |
mixed |
HTTP and SOCKS on the same TCP port |
tunnel |
Fixed-destination TCP or UDP port forwarder; optionally pinned to a specific outbound for proxy chaining |
Outbound type |
Behavior |
|---|---|
tuic |
TUIC v5 client over QUIC |
naive |
NaiveProxy client over HTTP/2 or QUIC via Cronet (TCP + UoT v2) |
socks |
Upstream SOCKS5 proxy with optional UDP ASSOCIATE (allow_udp) |
load-balance |
Proxy group with health checks (consistent-hashing, round-robin, or sticky-sessions) |
HTTP Basic and SOCKS5 username/password authentication share the configured authenticator; listeners requiring a password reject SOCKS4/4a. The first declared outbound acts as the default route.
Example config.toml:
[[inbounds]]
type = "mixed"
tag = "mixed-in"
listen_addr = "127.0.0.1:1080"
[[outbounds]]
type = "tuic"
tag = "tuic-out"
server_addr = "example.com:443"
sni = "example.com"
uuid = "00000000-0000-0000-0000-000000000000"
password = "change-me"Library callers using wind-socks directly can choose a listener mode with SocksInbound::with_mode (SocksInbound::new defaults to SOCKS5).
Both wind-quic and wind-tuic enable quiche by default (wind-tuic enables both quinn and quiche by default). For a Quinn-only build, disable default features and pick a Rustls crypto provider (ring or aws-lc-rs):
wind-tuic = { git = "https://github.com/rust-proxy/wind", default-features = false, features = ["client", "quinn", "ring"] }Enable quiche explicitly when defaults are disabled and the Quiche backend is needed.
Building the Quiche backend requires the target's BoringSSL C/C++ toolchain, CMake, and libclang; Windows builds also require NASM, and cross builds require the corresponding compiler and sysroot. The workspace patches quiche, tokio-quiche, and datagram-socket to the same pinned Git revision of rust-proxy/quiche so every backend consumer receives the same portability fixes.
The naive outbound (crates/wind-naive) uses Chromium Cronet through cronet-rs. By default it dynamically loads libcronet at runtime so ordinary builds never touch the network. The first successful dynamic load pins the Cronet library for the lifetime of the process; switching libraries requires a restart.
Build-time feature flags on the wind crate:
| Mode | Command | Notes |
|---|---|---|
| Dynamic + auto-download | cargo build -p wind --features download |
Fetches the target's prebuilt library from rust-proxy/cronet-binaries into OUT_DIR with SHA-256 verification. |
| Static (local archive) | CRONET_LIB_DIR=/path/to/lib cargo build -p wind --features naive-static |
Links a local glibc/musl, Apple, Android, or Windows MSVC (cronet.lib + link_flags.txt) archive. CRONET_LIB_DIR always overrides downloads. |
| Static + auto-download | cargo build -p wind --features naive-static,naive-download |
Downloads and verifies the pinned v154.0.8037.49 archive (and .link-flags.txt on Windows). Has no effect in dynamic mode. |
Notes on linking and platform CRTs:
- On desktop, enabling
naive-dynamicselects runtime loading even ifnaive-staticis also enabled. - On Windows, automatic downloads match Rust's CRT: default
/MDbuilds need no extraRUSTFLAGS, while explicit+crt-staticbuilds select/MTand should pass--target. Manually supplied archives must match the binary's CRT. - Custom unpinned assets require
CRONET_DOWNLOAD_SHA256(andCRONET_DOWNLOAD_LINK_FLAGS_SHA256on Windows).
See crates/wind-naive/README.md for runtime options, library search order, UDP-over-TCP v2 framing, and Docker end-to-end tests.
Wind documents its runtime state transitions and formally verifies core protocol, routing, and transport logic:
- Vest binary codecs: Cargo generates parsers and serializers at build time from Vest schemas for TUIC v5, SOCKS4/4a/5, and Naive UoT v2.
- Verus proofs: Seven workspace crates (
wind-tuic,wind-geodata,wind-acl,wind-naive,wind-socks,wind-core,wind-base) carry machine-checked proofs verified on bothx86_64andi686Linux in CI. See VERSU.md for the full guarantee table and local verification command. - State machine index: STATE-MACHINES.md maps every connection, stream, routing, and lifecycle state machine to its owner and regression tests.
Requires Rust 1.85+ (Edition 2024). Code formatting uses nightly rustfmt with hard tabs (see rustfmt.toml).
cargo +nightly fmt --all --check
cargo clippy --workspace --all-targets
cargo test --workspaceInitialize submodules only when working inside forks/quiche or forks/rustls-acme:
git submodule update --init --recursiveAI-assisted contributions must include the Assisted-by: commit trailer described in LLM.md.
- The
windCLI application crate (crates/wind) is licensed under AGPL-3.0-or-later (LICENSE-AGPLv3). - The library crates in this workspace are licensed under the Mozilla Public License 2.0 (MPL-2.0).