mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-14 17:15:24 +03:00
feat(xray): update xray-core to v26.10.21 and adapt panel
Bump xtls/xray-core to 1b1647cd9ddf (v26.10.21) and move the three binary pins (DockerInit.sh, both release.yml fetches) in lockstep. The v26.10.10 release was pulled upstream, so the old pins already 404. XDRIVE (#7182): the core now runs XDRIVE only for VLESS inside VLESS encryption, with no flow, and an outbound only over Mux; it refuses the whole config otherwise. The panel offers XDRIVE only for VLESS, refuses to save an inbound without decryption, never emits a client flow on an XDRIVE stream (config, JSON subscription, forms), and turns Mux on when an outbound picks XDRIVE. An inbound or template outbound stored before the upgrade that the core would refuse is left out of the generated config with a warning, so it no longer stops every other inbound. The service "Google Drive" is now "google-drive" (old name read as a deprecated alias); saves, the schema and both form adapters store the new name. XDRIVE and MASQUE gain a client xmux; both schemas keep it instead of stripping it on an inbound save. Lua scripts (#7124, #7136): the core refuses a routing script beside rules or domainStrategy, and a dns script beside the fallback/parallel switches or a domain-scoped server. The panel always keeps its api routing rule, so a template save now refuses any routing script and a dns script in a refused combination, and a stored one is dropped from the generated config so the core still starts. Noise masks gain a Lua script that the loader compiles inside Build: the in-process build (template save check, hot add) now resolves a relative script the way the xray child does, beside the xray binary, instead of failing it. The mask editor gets a Script field that replaces the noise list. XDNS (#7140): a resolver takes https:// DoH addresses with worker, tlsConfig and quicConfig. The mask editor registered only addrs, so a save dropped the rest; it now edits all four. Finalmask filter (#7206): a new TCP/UDP mask screens an inbound's source IPs. The inbound mask editor offers it with its allow and block lists; it is a no-op on a dialer and an older client core refuses the type, so the share link and JSON subscription drop it like the Go link already does.
This commit is contained in:
@@ -5,6 +5,8 @@ import (
|
||||
"errors"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/xtls/xray-core/infra/conf"
|
||||
)
|
||||
|
||||
func TestShouldSkipLegacyUnencryptedOutboundRejection(t *testing.T) {
|
||||
@@ -251,3 +253,60 @@ func TestEnsureStatsRouting_AcceptsInboundTagAsString(t *testing.T) {
|
||||
t.Fatalf("api rule with string-form inboundTag should hoist to front, got %q\nfull: %s", got, out)
|
||||
}
|
||||
}
|
||||
|
||||
// xray-core 26.10.17 (#7136) refuses a routing "script" beside rules, which SaveXraySetting always
|
||||
// keeps for the api inbound, and a dns "script" beside fallback switches or domain-scoped servers.
|
||||
func TestCheckXrayConfig_RefusesLuaScriptsTheCoreRefuses(t *testing.T) {
|
||||
const outbounds = `"outbounds":[{"protocol":"freedom","tag":"direct"}]`
|
||||
tests := []struct{ name, template, want string }{
|
||||
{"routing script", `{"routing":{"script":"route.lua"},` + outbounds + `}`, `routing: "script" cannot be used`},
|
||||
{"dns script beside a domain-scoped server", `{"dns":{"script":"dns.lua","servers":[{"address":"1.1.1.1","domains":["example.com"]}]},` + outbounds + `}`, `dns: "script" cannot be used`},
|
||||
{"dns script beside parallel queries", `{"dns":{"script":"dns.lua","enableParallelQuery":true,"servers":["1.1.1.1"]},` + outbounds + `}`, `dns: "script" cannot be used`},
|
||||
{"dns script beside plain servers", `{"dns":{"script":"dns.lua","servers":["1.1.1.1",{"address":"8.8.8.8"}]},` + outbounds + `}`, ""},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
err := (&XraySettingService{}).CheckXrayConfig(tc.template)
|
||||
if tc.want == "" {
|
||||
if err != nil {
|
||||
t.Fatalf("CheckXrayConfig = %v, want the script the core accepts kept", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if err == nil || !strings.Contains(err.Error(), tc.want) {
|
||||
t.Fatalf("CheckXrayConfig = %v, want one containing %q", err, tc.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// A template saved under 26.10.10 can carry those scripts; the build drops them so the core still
|
||||
// starts, and the vendored loader accepts the routing and dns sections it then emits.
|
||||
func TestGetXrayConfig_DropsLuaScriptsTheCoreRefuses(t *testing.T) {
|
||||
setupConflictDB(t)
|
||||
template := `{"outbounds":[{"protocol":"freedom","tag":"direct"}],
|
||||
"routing":{"domainStrategy":"AsIs","script":"route.lua","rules":[{"type":"field","inboundTag":["api"],"outboundTag":"api"}]},
|
||||
"dns":{"script":"dns.lua","servers":[{"address":"1.1.1.1","domains":["example.com"]}]}}`
|
||||
if err := (&SettingService{}).saveSetting("xrayTemplateConfig", template); err != nil {
|
||||
t.Fatalf("seed template: %v", err)
|
||||
}
|
||||
|
||||
cfg, err := (&XrayService{}).GetXrayConfig()
|
||||
if err != nil {
|
||||
t.Fatalf("GetXrayConfig: %v", err)
|
||||
}
|
||||
router := new(conf.RouterConfig)
|
||||
if err := json.Unmarshal(cfg.RouterConfig, router); err != nil {
|
||||
t.Fatalf("decode routing: %v", err)
|
||||
}
|
||||
if _, err := router.Build(); err != nil {
|
||||
t.Fatalf("xray-core refuses the emitted routing: %v", err)
|
||||
}
|
||||
dns := new(conf.DNSConfig)
|
||||
if err := json.Unmarshal(cfg.DNSConfig, dns); err != nil {
|
||||
t.Fatalf("decode dns: %v", err)
|
||||
}
|
||||
if _, err := dns.Build(); err != nil {
|
||||
t.Fatalf("xray-core refuses the emitted dns: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user