feat(xray): update xray-core to v26.10.10 and adapt panel

Move the three Xray binary pins (DockerInit.sh, both release.yml
fetches) to v26.10.10, in lockstep with the xtls/xray-core module that
82c77111 already bumped to 701af60772cd.

xdns finalmask (#7090): a domain now takes a "names" list instead of a
single "name", and a resolver is an "addrs" list of udp:// or tcp://
URLs instead of {type, settings:{addr}}. The loader ignores the old
keys rather than failing, so every mask the 26.9.30 seeder wrote would
load with no domain and no resolver and the tunnel would carry nothing.
maskcompat.UpgradeLegacyXdns now lifts both the pre-26.9.30 string lists
and the 26.9.30 objects straight to names/addrs, dropping entries the
old loader refused. A new seeder (XdnsFinalmaskNamesAddrsFix) reruns it
over every stored finalmask, and the save path, GetXrayConfig, both
link importers and the mask editor's mount lift go through it. Template
outbounds now get the build-time heal too: a 26.9.30 template pasted
after the seeder passes the save check, since the core loads that shape
without error. The editor edits names and addrs as tag lists and no
longer requires record types, which the core now defaults (TXT on a
client, A/CNAME/TXT/AAAA on a server). The wire format did not change,
but clients on an older core cannot read the new config shape.

Lua scripts (#6823): dns.script, routing.script and dns servers[].id
are new. The xray page parsed the dns block with a strict schema, so
loading it dropped script and id and the next save deleted them; the
schema now keeps both and the DNS server modal carries the id through
an edit. The hot routing apply built routing in-process, and that build
now resolves the script file from the panel's working directory, so a
script beside the xray binary failed every rule change into a full
restart and broke the node bridge. RoutingService cannot change the
script anyway, so the panel no longer resolves it there.

TLS client roots (#7105): the core now verifies against its bundled
Mozilla roots instead of the OS store unless tlsSettings.useSystemCA is
set. The outbound TLS form gets a switch for it, so an outbound to a
server signed by a privately installed CA can opt back in.
This commit is contained in:
MHSanaei
2026-10-11 07:55:12 +02:00
parent 82c7711189
commit 73a028f52d
37 changed files with 553 additions and 205 deletions
+7 -7
View File
@@ -1282,7 +1282,7 @@ func runSeeders(isUsersEmpty bool) error {
}
if empty && isUsersEmpty {
seeders := []string{"UserPasswordHash", "ClientsTable", "InboundClientsArrayFix", "InboundClientTgIdFix2", "InboundClientSubIdFix", "FreedomFinalRulesReverseFix", "FreedomFinalRulesPrivateEgressBlock", "UppercaseFreedomFinalRulesFix", "InboundRealityFinalmaskTcpStrip", "ApiTokensHash", "LegacyProxySettingsCleanup", "OutboundRemovedKeysFix", "FreedomDomainStrategyFix", "DNSOutboundLegacyKeysFix", "DNSOutboundQTypeZeroFix", "WireguardDomainStrategyFix", "XdnsFinalmaskObjectsFix", "WireguardPeersToClients", "MtprotoSecretsToClients", "NodeInboundsAdopted", "ResetIpLimitNoFail2ban"}
seeders := []string{"UserPasswordHash", "ClientsTable", "InboundClientsArrayFix", "InboundClientTgIdFix2", "InboundClientSubIdFix", "FreedomFinalRulesReverseFix", "FreedomFinalRulesPrivateEgressBlock", "UppercaseFreedomFinalRulesFix", "InboundRealityFinalmaskTcpStrip", "ApiTokensHash", "LegacyProxySettingsCleanup", "OutboundRemovedKeysFix", "FreedomDomainStrategyFix", "DNSOutboundLegacyKeysFix", "DNSOutboundQTypeZeroFix", "WireguardDomainStrategyFix", "XdnsFinalmaskNamesAddrsFix", "WireguardPeersToClients", "MtprotoSecretsToClients", "NodeInboundsAdopted", "ResetIpLimitNoFail2ban"}
for _, name := range seeders {
if err := db.Create(&model.HistoryOfSeeders{SeederName: name}).Error; err != nil {
return err
@@ -1423,8 +1423,8 @@ func runSeeders(isUsersEmpty bool) error {
}
}
if !slices.Contains(seedersHistory, "XdnsFinalmaskObjectsFix") {
if err := migrateXdnsFinalmaskObjects(); err != nil {
if !slices.Contains(seedersHistory, "XdnsFinalmaskNamesAddrsFix") {
if err := migrateXdnsFinalmaskShape(); err != nil {
return err
}
}
@@ -1928,9 +1928,9 @@ func strategyIsSet(value any) bool {
return s != "" && !strings.EqualFold(s, "asis")
}
// migrateXdnsFinalmaskObjects upgrades every stored xdns mask to the object shape
// xray-core 26.9.30 requires, wherever the panel keeps a finalmask.
func migrateXdnsFinalmaskObjects() error {
// migrateXdnsFinalmaskShape upgrades every stored xdns mask to the names/addrs shape
// xray-core 26.10.10 reads, wherever the panel keeps a finalmask.
func migrateXdnsFinalmaskShape() error {
return db.Transaction(func(tx *gorm.DB) error {
var inbounds []model.Inbound
if err := tx.Select("id", "stream_settings").Find(&inbounds).Error; err != nil {
@@ -1991,7 +1991,7 @@ func migrateXdnsFinalmaskObjects() error {
}
}
}
return tx.Create(&model.HistoryOfSeeders{SeederName: "XdnsFinalmaskObjectsFix"}).Error
return tx.Create(&model.HistoryOfSeeders{SeederName: "XdnsFinalmaskNamesAddrsFix"}).Error
})
}
@@ -7,10 +7,12 @@ import (
"github.com/mhsanaei/3x-ui/v3/internal/database/model"
)
const legacyXdnsFinalmask = `{"udp":[{"type":"xdns","settings":{"domains":["t.example.com"]}}]}`
// legacyXdnsFinalmask is the 26.9.30 object shape the previous seeder left in panel DBs;
// xray-core 26.10.10 reads neither its "name" nor its typed resolver.
const legacyXdnsFinalmask = `{"udp":[{"type":"xdns","settings":{"domains":[{"name":"t.example.com","types":[16],"edns0":1232}],"resolvers":[{"type":"udp","settings":{"addr":"8.8.8.8:53"}}]}}]}`
// assertXdnsUpgraded fails unless the finalmask's xdns domains are objects, the only
// shape xray-core 26.9.30 parses.
// assertXdnsUpgraded fails unless the finalmask's xdns mask uses the names/addrs lists,
// the only shape xray-core 26.10.10 reads.
func assertXdnsUpgraded(t *testing.T, where string, finalmask any) {
t.Helper()
fm, _ := finalmask.(map[string]any)
@@ -20,13 +22,13 @@ func assertXdnsUpgraded(t *testing.T, where string, finalmask any) {
}
mask, _ := udp[0].(map[string]any)
settings, _ := mask["settings"].(map[string]any)
domains, _ := settings["domains"].([]any)
if len(domains) != 1 {
t.Fatalf("%s: domains = %v, want one entry", where, settings["domains"])
got, err := json.Marshal(settings)
if err != nil {
t.Fatalf("%s: marshal xdns settings: %v", where, err)
}
domain, ok := domains[0].(map[string]any)
if !ok || domain["name"] != "t.example.com" {
t.Fatalf("%s: domain = %#v, want an object named t.example.com", where, domains[0])
const want = `{"domains":[{"edns0":1232,"names":["t.example.com"],"types":[16]}],"resolvers":[{"addrs":["udp://8.8.8.8:53"]}]}`
if string(got) != want {
t.Fatalf("%s: xdns settings\n got: %s\nwant: %s", where, got, want)
}
}
@@ -49,7 +51,7 @@ func TestXdnsFinalmaskSeederUpgradesEveryStoredMask(t *testing.T) {
if err := GetDB().Create(sub).Error; err != nil {
t.Fatalf("create outbound subscription: %v", err)
}
if err := GetDB().Where("seeder_name = ?", "XdnsFinalmaskObjectsFix").
if err := GetDB().Where("seeder_name = ?", "XdnsFinalmaskNamesAddrsFix").
Delete(&model.HistoryOfSeeders{}).Error; err != nil {
t.Fatalf("clear seeder history: %v", err)
}