mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-12 08:05:00 +03:00
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:
+17
-10
@@ -22,6 +22,7 @@ import (
|
||||
wgutil "github.com/mhsanaei/3x-ui/v3/internal/util/wireguard"
|
||||
|
||||
"github.com/xtls/xray-core/app/proxyman/command"
|
||||
"github.com/xtls/xray-core/app/router"
|
||||
routerService "github.com/xtls/xray-core/app/router/command"
|
||||
statsService "github.com/xtls/xray-core/app/stats/command"
|
||||
xnet "github.com/xtls/xray-core/common/net"
|
||||
@@ -262,16 +263,7 @@ func (x *XrayAPI) ApplyRoutingConfig(routing []byte) error {
|
||||
return common.NewError("xray RoutingServiceClient is not initialized")
|
||||
}
|
||||
|
||||
// Rules referencing geoip:/geosite: need the dat files; point xray-core's
|
||||
// in-process loader at the panel's bin folder where they live.
|
||||
ensureXrayAssetLocation()
|
||||
|
||||
routerConf := new(conf.RouterConfig)
|
||||
if err := json.Unmarshal(routing, routerConf); err != nil {
|
||||
logger.Debug("Failed to unmarshal routing config:", err)
|
||||
return err
|
||||
}
|
||||
config, err := routerConf.Build()
|
||||
config, err := buildReloadableRouting(routing)
|
||||
if err != nil {
|
||||
logger.Debug("Failed to build routing config:", err)
|
||||
return err
|
||||
@@ -287,6 +279,21 @@ func (x *XrayAPI) ApplyRoutingConfig(routing []byte) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// buildReloadableRouting builds the rules and balancers RoutingService.AddRule swaps in.
|
||||
// The Lua routing script is fixed at core start, so its file is never resolved here.
|
||||
func buildReloadableRouting(routing []byte) (*router.Config, error) {
|
||||
// Rules referencing geoip:/geosite: need the dat files; point xray-core's
|
||||
// in-process loader at the panel's bin folder where they live.
|
||||
ensureXrayAssetLocation()
|
||||
|
||||
routerConf := new(conf.RouterConfig)
|
||||
if err := json.Unmarshal(routing, routerConf); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
routerConf.Script = ""
|
||||
return routerConf.Build()
|
||||
}
|
||||
|
||||
// BalancerInfo is the live state of one balancer inside the running core.
|
||||
type BalancerInfo struct {
|
||||
Tag string `json:"tag"`
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package xray
|
||||
|
||||
import "testing"
|
||||
|
||||
// xray-core 26.10.10 resolves routing.script from the loader's working directory, and the
|
||||
// running core keeps its script anyway: a script beside the xray binary failed every hot
|
||||
// rule change panel-side, turning it into a full restart and breaking the node bridge.
|
||||
func TestBuildReloadableRouting_IgnoresLuaScript(t *testing.T) {
|
||||
t.Chdir(t.TempDir())
|
||||
routing := []byte(`{"script":"route.lua","rules":[{"type":"field","ip":["10.0.0.0/8"],"outboundTag":"direct"}]}`)
|
||||
|
||||
config, err := buildReloadableRouting(routing)
|
||||
if err != nil {
|
||||
t.Fatalf("buildReloadableRouting: %v", err)
|
||||
}
|
||||
if config.Script != "" {
|
||||
t.Fatalf("Script = %q, want it left to the running core", config.Script)
|
||||
}
|
||||
if len(config.Rule) != 1 || config.Rule[0].GetTag() != "direct" {
|
||||
t.Fatalf("rules = %v, want the one rule to direct", config.Rule)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user