TUN inbound: Make strictRoute false by default

Like sing-box's strict_route, strictRoute is now false by default, so the
Windows Filtering Platform filters are only added when it is set to true
(together with autoSystemRoutingTable). With unset meaning false,
strict_route becomes a plain bool field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
patterniha
2026-09-29 14:51:17 +03:30
co-authored by Claude Opus 5.5
parent 2db099b34b
commit eb29a4e3de
6 changed files with 15 additions and 24 deletions
+4 -5
View File
@@ -246,11 +246,10 @@ startOver:
}
}
// Once the system routes lead to the TUN, keep DNS if dns is set, and IPv6
// if the TUN cannot carry it (no IPv6 address, or no IPv6 route to it),
// from leaving through the other interfaces, unless strictRoute is off.
strictRoute := t.options.StrictRoute == nil || *t.options.StrictRoute
if blockDNS, blockIPv6 := len(dns) > 0, !address6 || !route6; strictRoute && (route4 || route6) && (blockDNS || blockIPv6) {
// With strictRoute, once the system routes lead to the TUN, keep DNS if
// dns is set, and IPv6 if the TUN cannot carry it (no IPv6 address, or no
// IPv6 route to it), from leaving through the other interfaces.
if blockDNS, blockIPv6 := len(dns) > 0, !address6 || !route6; t.options.StrictRoute && (route4 || route6) && (blockDNS || blockIPv6) {
if t.wfp, err = blockLeaks(t.luid, blockDNS, blockIPv6); err != nil {
what := "DNS and IPv6"
if !blockIPv6 {