Skip to content

Commit

Permalink
添加MTU计算方法
Browse files Browse the repository at this point in the history
  • Loading branch information
Fangliding authored and yuhan6665 committed Jan 2, 2024
1 parent c97a00d commit a066238
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/config/outbounds/wireguard.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,24 @@ Wireguard 会在本地开启虚拟网卡 tun。使用一个或多个 IP 地址
Wireguard 底层 tun 的分片大小。

<details>
<summary>MTU的计算方法</summary>

一个wireguard数据包的结构如下

```
- 20-byte IPv4 header or 40 byte IPv6 header
- 8-byte UDP header
- 4-byte type
- 4-byte key index
- 8-byte nonce
- N-byte encrypted data
- 16-byte authentication tag
```

```N-byte encrypted data```即为我们需要的MTU的值,根据endpoint是IPv4还是IPv6,具体的值可以是1440(IPv4)或者1420(IPv6),如果处于特殊环境下再额外减掉即可(如家宽PPPoE额外-8)。
</details>

> `reserved` \[ number \]
Wireguard 保留字节。
Expand Down

0 comments on commit a066238

Please sign in to comment.