Skip to content

Commit 6afd0b1

Browse files
committed
fix: Enhance WireGuard logging with MTU and address family details
1 parent 4183b05 commit 6afd0b1

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

app/src/main/java/io/nekohasekai/sagernet/fmt/ConfigBuilder.kt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,21 @@ fun buildConfig(
623623
is ShadowsocksRBean ->
624624
buildSingBoxOutboundShadowsocksRBean(bean)
625625

626-
is WireGuardBean ->
626+
is WireGuardBean -> {
627+
val endpointMtu = bean.mtu?.takeIf { it > 0 }
628+
val peerAddressFamily = when {
629+
bean.serverAddress?.contains(':') == true -> "ipv6"
630+
bean.serverAddress?.isNotBlank() == true -> "ipv4-or-domain"
631+
else -> "missing"
632+
}
633+
Logs.i(
634+
"WireGuardEndpointTrace profileId=${proxyEntity.id} forTest=$forTest " +
635+
"endpointMtu=${endpointMtu ?: "default(1408)"} " +
636+
"tunMtu=${DataStore.mtu} peerAddressFamily=$peerAddressFamily " +
637+
"peerPort=${bean.serverPort}"
638+
)
627639
buildSingBoxEndpointWireGuardBean(bean)
640+
}
628641

629642
is SSHBean ->
630643
buildSingBoxOutboundSSHBean(bean)

0 commit comments

Comments
 (0)