mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-10 15:15:00 +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:
@@ -666,6 +666,7 @@ func (s *InboundService) normalizeStreamSettings(inbound *model.Inbound) {
|
||||
}
|
||||
inbound.StreamSettings = canonicalizeStreamNetworkKey(inbound.StreamSettings)
|
||||
inbound.StreamSettings = canonicalizeLegacyXdnsMasks(inbound.StreamSettings)
|
||||
inbound.StreamSettings = canonicalizeXDriveService(inbound.StreamSettings)
|
||||
}
|
||||
|
||||
// canonicalizeLegacyXdnsMasks stores an xdns mask posted in a pre-26.10.10 shape in
|
||||
@@ -1006,6 +1007,11 @@ func validateFinalMaskSalamander(streamSettings string) error {
|
||||
return maskcompat.CheckSalamanderPasswords(stream["finalmask"])
|
||||
}
|
||||
|
||||
const (
|
||||
xdriveServiceGoogleDrive = "google-drive"
|
||||
xdriveServiceGoogleDriveLegacy = "Google Drive"
|
||||
)
|
||||
|
||||
// validateXDriveStorage refuses at save the XDRIVE storage xray-core refuses when an inbound starts
|
||||
// listening (stopping every inbound) or an outbound dials.
|
||||
func validateXDriveStorage(streamSettings string) error {
|
||||
@@ -1028,7 +1034,7 @@ func validateXDriveStorage(streamSettings string) error {
|
||||
if !hasFolder {
|
||||
return common.NewError(`XDRIVE needs a "remoteFolder": the local folder both ends share.`)
|
||||
}
|
||||
case "Google Drive":
|
||||
case xdriveServiceGoogleDrive, xdriveServiceGoogleDriveLegacy:
|
||||
if !hasFolder {
|
||||
return common.NewError(`XDRIVE needs a "remoteFolder": the id of the shared Google Drive folder.`)
|
||||
}
|
||||
@@ -1041,11 +1047,52 @@ func validateXDriveStorage(streamSettings string) error {
|
||||
}
|
||||
return validateXDriveTemplate(xd.Template)
|
||||
default:
|
||||
return common.NewError(fmt.Sprintf("unsupported XDRIVE service %q: use local, Google Drive or template.", xd.Service))
|
||||
return common.NewError(fmt.Sprintf("unsupported XDRIVE service %q: use local, google-drive or template.", xd.Service))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// validateXDriveInbound refuses what xray-core 26.10.17 refuses on an XDRIVE inbound (#7182): any
|
||||
// protocol but VLESS, and VLESS without "decryption". Flow is never emitted there and the port is single.
|
||||
func validateXDriveInbound(protocol, settings, streamSettings string) error {
|
||||
var stream struct {
|
||||
Network string `json:"network"`
|
||||
}
|
||||
if json.Unmarshal([]byte(streamSettings), &stream) != nil || stream.Network != "xdrive" {
|
||||
return nil
|
||||
}
|
||||
if protocol != string(model.VLESS) {
|
||||
return common.NewError(fmt.Sprintf("XDRIVE carries only VLESS, not %s.", protocol))
|
||||
}
|
||||
var vless struct {
|
||||
Decryption string `json:"decryption"`
|
||||
}
|
||||
_ = json.Unmarshal([]byte(settings), &vless)
|
||||
if !vlessEncValueSet(vless.Decryption) {
|
||||
return common.NewError(`XDRIVE needs VLESS encryption: set the inbound's Decryption.`)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// canonicalizeXDriveService stores the "google-drive" service xray-core 26.10.17 names
|
||||
// (#7182) in place of "Google Drive", which it still reads with a deprecation warning.
|
||||
func canonicalizeXDriveService(streamSettings string) string {
|
||||
var stream map[string]any
|
||||
if json.Unmarshal([]byte(streamSettings), &stream) != nil {
|
||||
return streamSettings
|
||||
}
|
||||
xd, _ := stream["xdriveSettings"].(map[string]any)
|
||||
if xd == nil || xd["service"] != xdriveServiceGoogleDriveLegacy {
|
||||
return streamSettings
|
||||
}
|
||||
xd["service"] = xdriveServiceGoogleDrive
|
||||
out, err := json.MarshalIndent(stream, "", " ")
|
||||
if err != nil {
|
||||
return streamSettings
|
||||
}
|
||||
return string(out)
|
||||
}
|
||||
|
||||
// validateXDriveTemplate applies the checks of xray-core's newTemplateStorage
|
||||
// (transport/internet/xdrive/template.go), which only run once the listener starts.
|
||||
func validateXDriveTemplate(raw json.RawMessage) error {
|
||||
@@ -1254,6 +1301,9 @@ func (s *InboundService) AddInbound(inbound *model.Inbound) (*model.Inbound, boo
|
||||
if err := validateXDriveStorage(inbound.StreamSettings); err != nil {
|
||||
return inbound, false, err
|
||||
}
|
||||
if err := validateXDriveInbound(string(inbound.Protocol), inbound.Settings, inbound.StreamSettings); err != nil {
|
||||
return inbound, false, err
|
||||
}
|
||||
if err := validateShadowsocks2022Inbound(inbound.Protocol, inbound.Settings); err != nil {
|
||||
return inbound, false, err
|
||||
}
|
||||
@@ -1905,6 +1955,9 @@ func (s *InboundService) UpdateInbound(inbound *model.Inbound) (*model.Inbound,
|
||||
if err := validateXDriveStorage(inbound.StreamSettings); err != nil {
|
||||
return inbound, false, err
|
||||
}
|
||||
if err := validateXDriveInbound(string(inbound.Protocol), inbound.Settings, inbound.StreamSettings); err != nil {
|
||||
return inbound, false, err
|
||||
}
|
||||
if err := validateShadowsocks2022Inbound(inbound.Protocol, inbound.Settings); err != nil {
|
||||
return inbound, false, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user