From a06623895337b85461d116faf1997217ddc64209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=8E=E6=89=87=E6=BB=91=E7=BF=94=E7=BF=BC?= Date: Tue, 2 Jan 2024 21:01:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0MTU=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/config/outbounds/wireguard.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/config/outbounds/wireguard.md b/docs/config/outbounds/wireguard.md index 9b1b03f..0e44224 100644 --- a/docs/config/outbounds/wireguard.md +++ b/docs/config/outbounds/wireguard.md @@ -46,6 +46,24 @@ Wireguard 会在本地开启虚拟网卡 tun。使用一个或多个 IP 地址 Wireguard 底层 tun 的分片大小。 +
+MTU的计算方法 + +一个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)。 +
+ > `reserved` \[ number \] Wireguard 保留字节。