2022-08-24 13:02:28 +00:00
|
|
|
|
### 结构
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
2022-08-31 05:21:29 +00:00
|
|
|
|
"type": "wireguard",
|
|
|
|
|
"tag": "wireguard-out",
|
|
|
|
|
|
|
|
|
|
"server": "127.0.0.1",
|
|
|
|
|
"server_port": 1080,
|
2022-09-09 07:40:35 +00:00
|
|
|
|
"system_interface": false,
|
|
|
|
|
"interface_name": "wg0",
|
2022-08-31 05:21:29 +00:00
|
|
|
|
"local_address": [
|
|
|
|
|
"10.0.0.2/32"
|
|
|
|
|
],
|
|
|
|
|
"private_key": "YNXtAzepDqRv9H52osJVDQnznT5AM11eCK3ESpwSt04=",
|
|
|
|
|
"peer_public_key": "Z1XXLsKYkYxuiYjJIkRvtIKFepCYHTgON+GwPq7SOV4=",
|
|
|
|
|
"pre_shared_key": "31aIhAPwktDGpH4JDhA8GNvjFXEf/a6+UaQRyOAiyfM=",
|
2022-10-29 10:00:05 +00:00
|
|
|
|
"reserved": [0, 0, 0],
|
2022-11-07 08:35:15 +00:00
|
|
|
|
"workers": 4,
|
2022-08-31 05:21:29 +00:00
|
|
|
|
"mtu": 1408,
|
|
|
|
|
"network": "tcp",
|
|
|
|
|
|
|
|
|
|
... // 拨号字段
|
2022-08-24 13:02:28 +00:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
!!! warning ""
|
|
|
|
|
|
2022-08-26 03:10:02 +00:00
|
|
|
|
默认安装不包含 WireGuard, 参阅 [安装](/zh/#_2)。
|
2022-08-24 13:02:28 +00:00
|
|
|
|
|
2022-09-15 04:20:38 +00:00
|
|
|
|
!!! warning ""
|
|
|
|
|
|
|
|
|
|
默认安装不包含被非特权 WireGuard 需要的 gVisor, 参阅 [安装](/zh/#_2)。
|
|
|
|
|
|
2022-08-31 05:21:29 +00:00
|
|
|
|
### 字段
|
2022-08-24 13:02:28 +00:00
|
|
|
|
|
|
|
|
|
#### server
|
|
|
|
|
|
|
|
|
|
==必填==
|
|
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
|
服务器地址。
|
2022-08-24 13:02:28 +00:00
|
|
|
|
|
|
|
|
|
#### server_port
|
|
|
|
|
|
|
|
|
|
==必填==
|
|
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
|
服务器端口。
|
2022-08-24 13:02:28 +00:00
|
|
|
|
|
2022-09-09 07:40:35 +00:00
|
|
|
|
#### system_interface
|
|
|
|
|
|
|
|
|
|
使用系统 tun 支持。
|
|
|
|
|
|
|
|
|
|
需要特权且不能与系统接口冲突。
|
|
|
|
|
|
2022-09-15 04:20:38 +00:00
|
|
|
|
如果 gVisor 未包含在构建中,则强制执行。
|
|
|
|
|
|
2022-09-09 07:40:35 +00:00
|
|
|
|
#### interface_name
|
|
|
|
|
|
|
|
|
|
启用 `system_interface` 时的自定义设备名称。
|
|
|
|
|
|
2022-08-24 13:02:28 +00:00
|
|
|
|
#### local_address
|
|
|
|
|
|
|
|
|
|
==必填==
|
|
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
|
接口的 IPv4/IPv6 地址或地址段的列表您。
|
2022-08-24 13:02:28 +00:00
|
|
|
|
|
2022-09-05 16:15:09 +00:00
|
|
|
|
要分配给接口的 IP(v4 或 v6)地址段列表。
|
2022-08-24 13:02:28 +00:00
|
|
|
|
|
|
|
|
|
#### private_key
|
|
|
|
|
|
|
|
|
|
==必填==
|
|
|
|
|
|
|
|
|
|
WireGuard 需要 base64 编码的公钥和私钥。 这些可以使用 wg(8) 实用程序生成:
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
wg genkey
|
|
|
|
|
echo "private key" || wg pubkey
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### peer_public_key
|
|
|
|
|
|
|
|
|
|
==必填==
|
|
|
|
|
|
|
|
|
|
WireGuard 对等公钥。
|
|
|
|
|
|
|
|
|
|
#### pre_shared_key
|
|
|
|
|
|
|
|
|
|
WireGuard 预共享密钥。
|
|
|
|
|
|
2022-10-29 10:00:05 +00:00
|
|
|
|
#### reserved
|
|
|
|
|
|
|
|
|
|
WireGuard 保留字段字节。
|
|
|
|
|
|
2022-11-07 08:35:15 +00:00
|
|
|
|
#### workers
|
|
|
|
|
|
|
|
|
|
WireGuard worker 数量。
|
|
|
|
|
|
|
|
|
|
默认使用 CPU 数量。
|
|
|
|
|
|
2022-08-24 13:02:28 +00:00
|
|
|
|
#### mtu
|
|
|
|
|
|
2022-11-07 08:35:15 +00:00
|
|
|
|
WireGuard MTU。
|
|
|
|
|
|
|
|
|
|
默认使用 1408。
|
2022-08-24 13:02:28 +00:00
|
|
|
|
|
|
|
|
|
#### network
|
|
|
|
|
|
|
|
|
|
启用的网络协议
|
|
|
|
|
|
|
|
|
|
`tcp` 或 `udp`。
|
|
|
|
|
|
|
|
|
|
默认所有。
|
|
|
|
|
|
|
|
|
|
### 拨号字段
|
|
|
|
|
|
2022-08-31 05:21:29 +00:00
|
|
|
|
参阅 [拨号字段](/zh/configuration/shared/dial/)。
|