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
+1 -1
View File
@@ -21,7 +21,7 @@ type TunConfig struct {
AutoSystemRoutingTable []string `json:"autoSystemRoutingTable"`
AutoOutboundsInterface *string `json:"autoOutboundsInterface"`
AutoSystemDNS bool `json:"autoSystemDNS"`
StrictRoute *bool `json:"strictRoute"`
StrictRoute bool `json:"strictRoute"`
}
func (v *TunConfig) Build() (proto.Message, error) {
+1 -7
View File
@@ -11,7 +11,6 @@ func TestTunConfigStrictRoute(t *testing.T) {
creator := func() Buildable {
return new(TunConfig)
}
enabled, disabled := true, false
runMultiTestCase(t, []TestCase{
{
@@ -19,15 +18,10 @@ func TestTunConfigStrictRoute(t *testing.T) {
Parser: loadJSON(creator),
Output: &tun.Config{Name: "xray0", Desc: "Wintun", MTU: 1500},
},
{
Input: `{"name": "xray0", "strictRoute": false}`,
Parser: loadJSON(creator),
Output: &tun.Config{Name: "xray0", Desc: "Wintun", MTU: 1500, StrictRoute: &disabled},
},
{
Input: `{"name": "xray0", "strictRoute": true}`,
Parser: loadJSON(creator),
Output: &tun.Config{Name: "xray0", Desc: "Wintun", MTU: 1500, StrictRoute: &enabled},
Output: &tun.Config{Name: "xray0", Desc: "Wintun", MTU: 1500, StrictRoute: true},
},
})
}