Files
3x-ui/internal/xray/config.go
T
MHSanaei 814cda3fb4 feat(xray): update xray-core to v26.7.11 and adapt panel
Bump xtls/xray-core to 50231eaf (v26.7.11) and the three binary pins
(DockerInit.sh, release.yml x2) in lockstep.

Adapt the panel to the upstream changes:

- Shadowsocks "none"/"plain" and VMess "none"/"zero" were removed from
  the core. A migration rewrites stored none/plain SS methods to a
  supported cipher and none/zero VMess security to "auto" (on both the
  clients column and inbound settings JSON); the SS build-time heal does
  the same so a row injected after boot cannot brick startup. The removed
  values are dropped from every frontend option list, schema and adapter,
  and coerced to "auto" at the Go link/sub/Clash emit sites and both link
  importers. Fix the CipherType_NONE sentinel that no longer compiles.

- Unencrypted vless/trojan outbounds to a public address are now refused
  by the core. Validate outbounds through the vendored config loader when
  saving the xray template and when storing/merging outbound
  subscriptions, so one such outbound cannot keep the core from starting.

- New TCP finalmask type "xmc" (Minecraft mimicry): add it to the sub
  link allowlist, the frontend enum and the FinalMask form (hostname,
  usernames, required password), and document it.

- streamSettings gained a "method" alias for "network"; canonicalize it
  to "network" at inbound save time and in the form adapters/schema so a
  method-keyed config keeps its transport.

- New root "env" config key is passed through xray.Config, compared in
  Equals, and forces a restart in the hot diff.

- REALITY now defaults minClientVer to 26.3.27; update the form
  placeholder.
2026-07-12 00:30:47 +02:00

87 lines
2.5 KiB
Go

package xray
import (
"bytes"
"github.com/mhsanaei/3x-ui/v3/internal/util/json_util"
)
// Config represents the complete Xray configuration structure.
// It contains all sections of an Xray config file including inbounds, outbounds, routing, etc.
type Config struct {
LogConfig json_util.RawMessage `json:"log"`
RouterConfig json_util.RawMessage `json:"routing"`
DNSConfig json_util.RawMessage `json:"dns,omitempty"`
InboundConfigs []InboundConfig `json:"inbounds"`
OutboundConfigs json_util.RawMessage `json:"outbounds"`
Transport json_util.RawMessage `json:"transport,omitempty"`
Policy json_util.RawMessage `json:"policy"`
API json_util.RawMessage `json:"api"`
Stats json_util.RawMessage `json:"stats"`
Reverse json_util.RawMessage `json:"reverse,omitempty"`
FakeDNS json_util.RawMessage `json:"fakedns,omitempty"`
Observatory json_util.RawMessage `json:"observatory,omitempty"`
BurstObservatory json_util.RawMessage `json:"burstObservatory,omitempty"`
Metrics json_util.RawMessage `json:"metrics"`
Geodata json_util.RawMessage `json:"geodata,omitempty"`
Env json_util.RawMessage `json:"env,omitempty"`
}
// Equals compares two Config instances for deep equality.
func (c *Config) Equals(other *Config) bool {
if len(c.InboundConfigs) != len(other.InboundConfigs) {
return false
}
for i, inbound := range c.InboundConfigs {
if !inbound.Equals(&other.InboundConfigs[i]) {
return false
}
}
if !bytes.Equal(c.LogConfig, other.LogConfig) {
return false
}
if !bytes.Equal(c.RouterConfig, other.RouterConfig) {
return false
}
if !bytes.Equal(c.DNSConfig, other.DNSConfig) {
return false
}
if !bytes.Equal(c.OutboundConfigs, other.OutboundConfigs) {
return false
}
if !bytes.Equal(c.Transport, other.Transport) {
return false
}
if !bytes.Equal(c.Policy, other.Policy) {
return false
}
if !bytes.Equal(c.API, other.API) {
return false
}
if !bytes.Equal(c.Stats, other.Stats) {
return false
}
if !bytes.Equal(c.Reverse, other.Reverse) {
return false
}
if !bytes.Equal(c.FakeDNS, other.FakeDNS) {
return false
}
if !bytes.Equal(c.Observatory, other.Observatory) {
return false
}
if !bytes.Equal(c.BurstObservatory, other.BurstObservatory) {
return false
}
if !bytes.Equal(c.Metrics, other.Metrics) {
return false
}
if !bytes.Equal(c.Geodata, other.Geodata) {
return false
}
if !bytes.Equal(c.Env, other.Env) {
return false
}
return true
}