mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-06 05:04:22 +00:00
- Update go.mod module path from mhsanaei/3x-ui/v3 to saeederamy/3x-ui/v3 - Update all 73 Go files' import paths accordingly - Fix README.fa_IR.md install command to point to fork's main branch The fork was referencing the original repo's module path in go.mod and all Go source imports, making it dependent on MHSanaei's namespace at build time. https://claude.ai/code/session_01M6d5atbWjuLTj6UwRHoK5m
72 lines
2 KiB
Go
72 lines
2 KiB
Go
package xray
|
|
|
|
import (
|
|
"bytes"
|
|
|
|
"github.com/saeederamy/3x-ui/v3/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"`
|
|
InboundConfigs []InboundConfig `json:"inbounds"`
|
|
OutboundConfigs json_util.RawMessage `json:"outbounds"`
|
|
Transport json_util.RawMessage `json:"transport"`
|
|
Policy json_util.RawMessage `json:"policy"`
|
|
API json_util.RawMessage `json:"api"`
|
|
Stats json_util.RawMessage `json:"stats"`
|
|
Reverse json_util.RawMessage `json:"reverse"`
|
|
FakeDNS json_util.RawMessage `json:"fakedns"`
|
|
Observatory json_util.RawMessage `json:"observatory"`
|
|
BurstObservatory json_util.RawMessage `json:"burstObservatory"`
|
|
Metrics json_util.RawMessage `json:"metrics"`
|
|
}
|
|
|
|
// 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.Metrics, other.Metrics) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|