TUN inbound: Rename to autoSystemWfpBlockLeak and autoSystemDnsToGateway

autoSystemWFP becomes autoSystemWfpBlockLeak, saying that the WFP filters
block leaks, and autoSystemDNS becomes autoSystemDnsToGateway, saying
where it points the system DNS, so that pointing the system DNS at the
gateway on Windows later would fit the same name. Their config fields
keep their numbers; neither was released.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
patterniha
2026-09-30 02:31:00 +03:30
co-authored by Claude Opus 5.5
parent 63de6135cb
commit 4ec4fb8aab
8 changed files with 40 additions and 34 deletions
+4 -4
View File
@@ -20,8 +20,8 @@ type TunConfig struct {
UserLevel uint32 `json:"userLevel"`
AutoSystemRoutingTable []string `json:"autoSystemRoutingTable"`
AutoOutboundsInterface *string `json:"autoOutboundsInterface"`
AutoSystemDNS bool `json:"autoSystemDNS"`
AutoSystemWFP bool `json:"autoSystemWFP"`
AutoSystemDnsToGateway bool `json:"autoSystemDnsToGateway"`
AutoSystemWfpBlockLeak bool `json:"autoSystemWfpBlockLeak"`
}
func (v *TunConfig) Build() (proto.Message, error) {
@@ -33,8 +33,8 @@ func (v *TunConfig) Build() (proto.Message, error) {
DNS: v.DNS,
UserLevel: v.UserLevel,
AutoSystemRoutingTable: v.AutoSystemRoutingTable,
AutoSystemDns: v.AutoSystemDNS,
AutoSystemWfp: v.AutoSystemWFP,
AutoSystemDnsToGateway: v.AutoSystemDnsToGateway,
AutoSystemWfpBlockLeak: v.AutoSystemWfpBlockLeak,
}
if v.AutoOutboundsInterface != nil {
config.AutoOutboundsInterface = *v.AutoOutboundsInterface
+8 -3
View File
@@ -7,7 +7,7 @@ import (
"github.com/xtls/xray-core/proxy/tun"
)
func TestTunConfigAutoSystemWFP(t *testing.T) {
func TestTunConfigAutoSystem(t *testing.T) {
creator := func() Buildable {
return new(TunConfig)
}
@@ -19,9 +19,14 @@ func TestTunConfigAutoSystemWFP(t *testing.T) {
Output: &tun.Config{Name: "xray0", Desc: "Wintun", MTU: 1500},
},
{
Input: `{"name": "xray0", "autoSystemWFP": true}`,
Input: `{"name": "xray0", "autoSystemDnsToGateway": true}`,
Parser: loadJSON(creator),
Output: &tun.Config{Name: "xray0", Desc: "Wintun", MTU: 1500, AutoSystemWfp: true},
Output: &tun.Config{Name: "xray0", Desc: "Wintun", MTU: 1500, AutoSystemDnsToGateway: true},
},
{
Input: `{"name": "xray0", "autoSystemWfpBlockLeak": true}`,
Parser: loadJSON(creator),
Output: &tun.Config{Name: "xray0", Desc: "Wintun", MTU: 1500, AutoSystemWfpBlockLeak: true},
},
})
}