WireGuard 配置

Chute 支持 WireGuard 作为出站代理协议。你可以在 [Proxy] 部分中内联配置 WireGuard,也可以定义一个命名的 [WireGuard] 部分并引用它。

WireGuard 部分

[WireGuard] 部分定义了一个完整的 WireGuard 隧道配置,可以通过名称从 WireGuard 代理策略中引用。

[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

参数

必填 描述
private-key WireGuard 私钥,base64 编码
peer-public-key 对等节点公钥,base64 编码
self-ip WireGuard 接口的本地 IPv4 地址
self-ip-v6 WireGuard 接口的本地 IPv6 地址
preshared-key 用于后量子抗性的预共享密钥
server 是* 远程服务器地址(当代理行未指定时使用;代理行优先)
port 是* 远程服务器端口(优先级与 server 相同)
wg-mtu WireGuard 接口的 MTU(默认:1420)。mtu 仅在 [Proxy] 行内联时可用
keepalive 持久保活间隔(秒)
reserved WireGuard 握手头部的保留字节(例如 reserved=0,1,2

* serverport 必须出现在该部分或引用它的 [Proxy] 行中;否则该策略会因不完整而被拒绝。

用法

从代理策略中引用该部分:

[Proxy]
WG = wireguard, section-name=wg0

[Proxy Group]
WGGroup = select, WG

[Rule]
IP-CIDR,10.0.0.0/8,WGGroup
FINAL,DIRECT

可以定义多个 [WireGuard] 部分用于不同隧道:

[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

注意:WireGuard 运行在自身的 UDP 隧道上,并使用用户态 TCP/IP 协议栈。名称(例如 wg0)区分大小写。

AmneziaWG 部分

Chute 还支持 AmneziaWG,一种带流量混淆的 WireGuard 变体。[AmneziaWG <name>] 部分接受与 [WireGuard] 部分相同的键,外加以下混淆参数:

  • jcjminjmax —— 垃圾包数量及大小范围
  • s1s2s3s4 —— 在 init/response/cookie/transport 包前添加的垃圾数据
  • h1h2h3h4 —— 自定义消息类型头部值
  • i1i2i3i4i5 —— 特殊垃圾包定义

策略通过类型 amneziawg(别名 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 = 68
h1 = 123456
h2 = 67543
h3 = 32345
h4 = 123123

[Proxy]
AWG = amneziawg, section-name=awg0

交叉校验规则:

  • 在普通 [WireGuard] 部分中使用 AmneziaWG 参数属于配置错误——请改用 [AmneziaWG] 部分。
  • reserved 不能在 [AmneziaWG] 部分中使用:它写入的头部字节与 h4 替换的字节相同,因此这种组合会被作为错误拒绝。
  • 不含任何混淆参数的 [AmneziaWG] 部分会得到一条提示——它的行为与普通 WireGuard 相同。
S. Smart Rabbit LLC © All Rights Reserved            updated 2026-08-18 11:57:36

本页为英文版的翻译。如内容有出入,以英文版为准。

results matching ""

    No results matching ""