CLI and Configuration¶
This page documents command-line flags, configuration discovery and merge precedence, WIND_ environment overrides, and strict startup validation for the standalone wind binary. See Inbounds and Outbounds for per-protocol fields.
Command-Line Options¶
| Flag | Alias | Value | Default | Description |
|---|---|---|---|---|
-c, --config |
-f |
<PATH> |
None | Additional config file path; extension must be .toml, .yaml, or .yml |
-C, --config-dir |
-d |
<PATH> |
Working directory | Directory searched for config.toml and config.yaml |
-D, --work-dir |
— | <PATH> |
Inherited | Changes process working directory before loading configs or running init |
--log-level |
-l |
<LEVEL> |
info |
Log level: trace, debug, info, warn, or error |
-v, --version |
-V |
— | — | Prints wind <version> and exits (overridable at build time via WIND_OVERRIDE_VERSION) |
Subcommands¶
wind init [--format yaml|toml]: Exports a default configuration toconfig.yamlorconfig.tomlin the working directory (or--config-dir).--format/-fdefaults toyaml.
Log Filtering Scope¶
--log-level adjusts log verbosity for every crate in the wind workspace while keeping external dependency targets at info. Unknown log level names fail immediately at startup.
Loading and Merge Precedence¶
wind loads configuration via Figment, merging layers in order (later layers override earlier ones):
- Directory defaults:
- With
--config-dir <DIR>, merges<DIR>/config.tomlthen<DIR>/config.yamlif present. - Without
--config-dir, merges./config.tomlthen./config.yamlif present. - Explicit config file: With
--config <PATH>, merges the file according to its extension (.toml,.yaml, or.yml). Unknown extensions (such as.json) fail fast instead of falling back to TOML. - Environment variables: Merges variables prefixed with
WIND_.
Working directory order
When --work-dir is combined with relative --config or --config-dir paths, wind switches to --work-dir first and resolves relative paths from there.
Top-Level Structure¶
A configuration file contains two top-level keys:
| Key | Type | Required | Description |
|---|---|---|---|
inbounds |
List | No (default empty) | Inbound listeners discriminated by type |
outbounds |
List | Yes (at least 1) | Outbound handlers discriminated by type |
inbounds:
- type: socks # socks | http | mixed | tunnel
tag: local-in
listen_addr: "127.0.0.1:1080"
outbounds:
- type: tuic # socks | tuic | naive | load-balance
tag: main-out
server_addr: "203.0.113.10:8443"
sni: "tuic.example.com"
uuid: "00000000-0000-4000-8000-000000000001"
password: "change-this-password"
Default Routing and Static Validation¶
Before opening sockets or dialing peers, wind resolves PersistentConfig into strongly typed ResolvedConfig and enforces:
- Strict unknown-field rejection: Every persisted config struct uses
deny_unknown_fields. Typos such asoutbunds,server_adr, orproxysfail loudly at startup naming the offending key. - Unique tags: Inbound tags must be distinct from one another, and outbound tags must be distinct from one another.
- Default outbound:
outboundsmust be non-empty; the first declared outbound becomes the router's default target. - Current router policy: Standalone
windusesDefaultRouter, forwarding all non-pinned inbound flows to the default outbound. For rule-based ACL routing, GeoIP/GeoSite matching, or loopback/private guards, integratewind-aclas a library or use TUIC. - Pinned outbound validation: Any inbound
outboundtag must exist inoutbounds. Pinned traffic bypasses the router and never falls back to the default outbound. - Load-balance topological sorting:
load-balancegroups may reference outbounds (including nested groups) declared later in the file. Resolution topologically orders children before parents and rejects missing references, self-references, and dependency cycles. - Address and parameter bounds:
tuic.server_addrmust parse as aSocketAddr;tunnel.remote_addrandsocks.server_addrreject empty or >255-byte domains and port0;tunnelUDPtimeoutmust be at least4ns;socksoutboundusername/passwordmust both be present (1–255 bytes each) or both omitted.
Startup Phases and Cleanup¶
Components initialize in a deterministic sequence to support chained transports without leaking listeners:
- Construct all
socksoutbounds. - Bind and start
tunnelinbounds pinned to thosesocksoutbounds early (so eager transports can connect through them; see Chained Proxies). - Construct remaining outbounds (
tuic,naive,load-balance) in topological order and start active health checks for non-lazygroups. - Bind and start remaining inbound listeners.
Early listeners are owned by RunningInbound guards; if a later step fails or startup is cancelled, already-bound ports and tasks are automatically stopped and released.