Fix "Remove unnecessary addRoute"

This commit is contained in:
世界 2024-05-08 13:16:59 +08:00
parent 03d5304abb
commit 0cb3cf62ed
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -83,6 +83,8 @@ class VPNService : VpnService(), PlatformInterfaceWrapper {
while (inet4RouteAddress.hasNext()) {
builder.addRoute(inet4RouteAddress.next().toIpPrefix())
}
} else if (options.inet4Address.hasNext()) {
builder.addRoute("0.0.0.0", 0)
}
val inet6RouteAddress = options.inet6RouteAddress
@ -90,6 +92,8 @@ class VPNService : VpnService(), PlatformInterfaceWrapper {
while (inet6RouteAddress.hasNext()) {
builder.addRoute(inet6RouteAddress.next().toIpPrefix())
}
} else if (options.inet6Address.hasNext()) {
builder.addRoute("::", 0)
}
val inet4RouteExcludeAddress = options.inet4RouteExcludeAddress