WireGuard Configuration
Chute supports WireGuard as an outbound proxy protocol. You can either configure WireGuard inline in the [Proxy] section, or define a named [WireGuard] section and reference it.
WireGuard Section
A [WireGuard] section defines a complete WireGuard tunnel configuration that can be referenced by name from a WireGuard proxy server.
[WireGuard wg0]
private-key = base64_private_key
peer-public-key = base64_peer_public_key
self-ip = 10.0.0.2
self-ip-v6 = fd00::2
preshared-key = base64_preshared_key
server = example.com
port = 51820
wg-mtu = 1420
keepalive = 25
Parameters
| Key | Required | Description |
|---|---|---|
private-key |
Yes | WireGuard private key, base64-encoded |
peer-public-key |
Yes | Peer public key, base64-encoded |
self-ip |
No | Local IPv4 address for the WireGuard interface (default: 10.0.0.2, for both WireGuard and AmneziaWG) |
self-ip-v6 |
No | Local IPv6 address for the WireGuard interface |
preshared-key |
No | Pre-shared key for post-quantum resistance |
server |
Yes* | Remote server address (used when the proxy line does not specify one; the proxy line takes precedence) |
port |
Yes* | Remote server port (same precedence as server) |
wg-mtu |
No | MTU for the WireGuard interface (default: 1420). mtu in the section is read as wg-mtu; an explicit wg-mtu wins |
keepalive |
No | Persistent keepalive interval in seconds. Absent, no keepalive is sent |
allowed-ips |
No | The destinations the peer carries, as comma-separated CIDRs (e.g. allowed-ips = 10.0.0.0/8, 192.168.1.0/24). A connection to an address outside them is refused (TCP) or dropped (UDP). Absent, or listing both 0.0.0.0/0 and ::/0, means every destination; an entry that is not a CIDR is ignored with a warning |
reserved |
No | Reserved bytes for the WireGuard handshake header (e.g. reserved=0,1,2) — parsed, but the current engine does not apply it and logs a warning |
* server and port must be present either in the section or on the referencing [Proxy] line; otherwise the policy is rejected as incomplete.
Surge peer Syntax
A section may describe its peer the way Surge does:
[WireGuard wg0]
private-key = base64_private_key
self-ip = 10.0.0.2
mtu = 1280
peer = (public-key = base64_peer_public_key, endpoint = example.com:51820, preshared-key = base64_preshared_key, keepalive = 25, client-id = 1/2/3, allowed-ips = "0.0.0.0/0, ::/0")
public-keybecomespeer-public-key,endpoint(host:port, or[v6]:port) becomesserverandport,client-id = a/b/cbecomesreserved, andpreshared-keyandkeepalivekeep their names. A key written directly in the section wins over the same value insidepeer. The current engine parsesreservedbut does not apply it.- Only one peer is used; a second one is reported as an advisory and ignored.
allowed-ipsis compiled and enforced for WireGuard TCP and UDP: a destination outside the peer's CIDRs is refused or dropped because that peer cannot route it back. Surge's section keysdns-serverandprefer-ipv6remain preserved but have no effect and appear in the notice about ignored options.- When the configuration is saved, the section is written back with the keys above instead of the
peer = (…)line.
Usage
Reference the section from a proxy server:
[Proxy]
WG = wireguard, section-name=wg0
[Proxy Group]
WGGroup = select, WG
[Rule]
IP-CIDR,10.0.0.0/8,WGGroup
FINAL,DIRECT
Multiple [WireGuard] sections can be defined for different tunnels:
[WireGuard us]
private-key = ...
peer-public-key = ...
self-ip = 10.0.1.2
[WireGuard eu]
private-key = ...
peer-public-key = ...
self-ip = 10.0.2.2
Note: WireGuard runs over its own UDP tunnel with a userspace TCP/IP stack. The names (e.g.
wg0) are case-sensitive.
AmneziaWG Section
Chute also supports AmneziaWG, a WireGuard variant with traffic obfuscation. An [AmneziaWG <name>] section accepts the same keys as a [WireGuard] section, plus the following obfuscation parameters:
jc,jmin,jmax— junk packet count and size range. Withjcabove zero,jminandjmaxmust both be set, andjmaxmust not be smaller thanjmin, or the tunnel is refused.s1,s2,s3,s4— junk prepended to init/response/cookie/transport packets.s1–s3may not exceed 64 bytes (s432), ands1 + 148must differ froms2 + 92, or the tunnel is refused.h1,h2,h3,h4— custom message-type header values. Each is a decimal number or astart-endrange within 32 bits, and must be greater than 4, since 1–4 are WireGuard's own message types; the four may not overlap, or the tunnel is refused.i1,i2,i3,i4,i5— special junk packet definitions. A definition that does not parse refuses the tunnel.
A refused parameter combination is logged as WireGuard: AmneziaWG parameters rejected: <reason>, and the tunnel then fails with Failed to create BoringTun tunnel.
A policy references the section with type amneziawg (alias awg):
[AmneziaWG awg0]
private-key = base64_private_key
peer-public-key = base64_peer_public_key
self-ip = 10.0.0.2
server = example.com
port = 51820
jc = 4
jmin = 40
jmax = 70
s1 = 15
s2 = 60
h1 = 123456
h2 = 67543
h3 = 32345
h4 = 123123
[Proxy]
AWG = amneziawg, section-name=awg0
Cross-validation rules:
- AmneziaWG parameters in a plain
[WireGuard]section are a configuration error — use an[AmneziaWG]section instead. reservedcannot be used in an[AmneziaWG]section: it writes the same header bytes thath4replaces, so the combination is rejected as an error.- An
[AmneziaWG]section with no obfuscation parameters gets an advisory — it behaves as plain WireGuard.