mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-09-27 20:26:42 +08:00
c54c28d92d
The JSON-subscription template still set settings.domainStrategy on its freedom outbound, the placement #6515 moved off everywhere else, so xray-core migrated it to sockopt with a deprecation warning on every load. AsIs is the core default when the key is absent, so dropping it changes nothing else. Fixes #6482.
40 lines
1.2 KiB
Go
40 lines
1.2 KiB
Go
package sub
|
|
|
|
import (
|
|
"encoding/json"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// xray-core moves freedom settings.domainStrategy to sockopt with a warning on
|
|
// every load (#6482); the embed omits it and gets the AsIs default.
|
|
func TestDefaultJSON_FreedomOutboundHasNoLegacyDomainStrategy(t *testing.T) {
|
|
var cfg map[string]any
|
|
if err := json.Unmarshal([]byte(defaultJson), &cfg); err != nil {
|
|
t.Fatalf("unmarshal embedded default.json: %v", err)
|
|
}
|
|
outbounds, _ := cfg["outbounds"].([]any)
|
|
var sawFreedom bool
|
|
for _, raw := range outbounds {
|
|
ob, _ := raw.(map[string]any)
|
|
proto, _ := ob["protocol"].(string)
|
|
if !strings.EqualFold(proto, "freedom") {
|
|
continue
|
|
}
|
|
sawFreedom = true
|
|
settings, _ := ob["settings"].(map[string]any)
|
|
if _, ok := settings["domainStrategy"]; ok {
|
|
t.Fatalf("freedom outbound %q still has settings.domainStrategy=%v; use sockopt or omit (AsIs default)", ob["tag"], settings["domainStrategy"])
|
|
}
|
|
if _, ok := settings["targetStrategy"]; ok {
|
|
t.Fatalf("freedom outbound %q still has settings.targetStrategy", ob["tag"])
|
|
}
|
|
if _, ok := ob["targetStrategy"]; ok {
|
|
t.Fatalf("freedom outbound %q still has root targetStrategy", ob["tag"])
|
|
}
|
|
}
|
|
if !sawFreedom {
|
|
t.Fatal("embedded default.json has no freedom outbound to check")
|
|
}
|
|
}
|