mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-10-23 22:35:03 +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:
@@ -715,6 +715,7 @@ func (s *SubJsonService) streamData(stream string, clientKey string) map[string]
|
||||
}
|
||||
}
|
||||
delete(streamSettings, "sockopt")
|
||||
dropServerOnlyFinalMasks(streamSettings["finalmask"])
|
||||
|
||||
// The inbound's own hop range becomes a mask first, so the global default yields to it.
|
||||
maskcompat.UpgradeLegacyUDPHop(streamSettings["finalmask"])
|
||||
|
||||
@@ -176,6 +176,27 @@ func TestSubJsonServiceMergesWithExistingFinalMask(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// The inbound "filter" mask (xray-core 26.10.21) screens the listener's source IPs: it would hand
|
||||
// clients the server's IP policy, and a client core older than it refuses the unknown type.
|
||||
func TestSubJsonServiceDropsTheServerOnlyFilterMask(t *testing.T) {
|
||||
svc := NewSubJsonService("", "", "", "", nil)
|
||||
stream := svc.streamData(`{"network":"kcp","security":"none","finalmask":{
|
||||
"tcp":[{"type":"filter","settings":{"allowedSourceIPs":["10.0.0.0/8"]}}],
|
||||
"udp":[{"type":"filter","settings":{"blockedSourceIPs":["geoip:cn"]}},{"type":"mkcp-legacy","settings":{"header":""}}]}}`, "")
|
||||
|
||||
finalmask, _ := stream["finalmask"].(map[string]any)
|
||||
if _, ok := finalmask["tcp"]; ok {
|
||||
t.Fatalf("finalmask.tcp = %#v, want it gone with its only mask", finalmask["tcp"])
|
||||
}
|
||||
udp, _ := finalmask["udp"].([]any)
|
||||
if len(udp) != 1 {
|
||||
t.Fatalf("finalmask.udp = %#v, want only the mkcp-legacy mask", udp)
|
||||
}
|
||||
if mask, _ := udp[0].(map[string]any); mask["type"] != "mkcp-legacy" {
|
||||
t.Fatalf("finalmask.udp[0] = %#v, want mkcp-legacy", mask)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSubJsonServiceNoFinalMaskWhenEmpty(t *testing.T) {
|
||||
svc := NewSubJsonService("", "", "", "", nil)
|
||||
stream := svc.streamData(`{"network":"tcp","security":"none","tcpSettings":{"header":{"type":"none"}}}`, "")
|
||||
|
||||
+26
-1
@@ -1203,8 +1203,11 @@ func vlessClientEncryption(settings map[string]any) string {
|
||||
}
|
||||
|
||||
// vlessFlowAllowed mirrors inboundCanEnableTlsFlow in internal/web/service: Vision runs over
|
||||
// TLS/REALITY on raw TCP, or inside VLESS encryption on any transport.
|
||||
// TLS/REALITY on raw TCP, or inside VLESS encryption on any transport but XDRIVE.
|
||||
func vlessFlowAllowed(network, security string, settings map[string]any) bool {
|
||||
if network == "xdrive" {
|
||||
return false
|
||||
}
|
||||
if network == "tcp" && (security == "tls" || security == "reality") {
|
||||
return true
|
||||
}
|
||||
@@ -2706,6 +2709,28 @@ var validFinalMaskTCPTypes = map[string]struct{}{
|
||||
"xmc": {},
|
||||
}
|
||||
|
||||
// dropServerOnlyFinalMasks removes the inbound "filter" mask (xray-core 26.10.21, #7206): it only
|
||||
// screens the listener's source IPs, and a client core older than it refuses the unknown type.
|
||||
func dropServerOnlyFinalMasks(finalmask any) {
|
||||
fm, _ := finalmask.(map[string]any)
|
||||
for _, layer := range []string{"tcp", "udp"} {
|
||||
masks, ok := fm[layer].([]any)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
kept := slices.DeleteFunc(masks, func(entry any) bool {
|
||||
mask, _ := entry.(map[string]any)
|
||||
maskType, _ := mask["type"].(string)
|
||||
return strings.EqualFold(maskType, "filter")
|
||||
})
|
||||
if len(kept) == 0 {
|
||||
delete(fm, layer)
|
||||
} else {
|
||||
fm[layer] = kept
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// applyKcpShareParams reconstructs legacy KCP share-link fields from either
|
||||
// the historical kcpSettings.header/seed shape or the current finalmask model.
|
||||
// This keeps subscription output compatible while avoiding panics when older
|
||||
|
||||
@@ -33,6 +33,7 @@ func TestVlessFlowAllowed(t *testing.T) {
|
||||
{"xhttp tls vlessenc", "xhttp", "tls", enc, true},
|
||||
{"xhttp reality no vlessenc", "xhttp", "reality", noEnc, false},
|
||||
{"ws tls", "ws", "tls", noEnc, false},
|
||||
{"xdrive vlessenc (xray-core #7182)", "xdrive", "none", enc, false},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user