Config: Remove some legacy fields from V2Ray 3.x era (#3776)

https://github.com/XTLS/Xray-core/pull/3776#issue-2512316726
This commit is contained in:
Kobe Arthur Scofield 2024-09-09 14:03:21 +08:00 committed by GitHub
parent 9438517130
commit f04cb0b288
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 54 additions and 176 deletions

View file

@ -57,10 +57,6 @@ func (c *VMessDetourConfig) Build() *inbound.DetourConfig {
}
}
type FeaturesConfig struct {
Detour *VMessDetourConfig `json:"detour"`
}
type VMessDefaultConfig struct {
Level byte `json:"level"`
}
@ -74,7 +70,6 @@ func (c *VMessDefaultConfig) Build() *inbound.DefaultConfig {
type VMessInboundConfig struct {
Users []json.RawMessage `json:"clients"`
Features *FeaturesConfig `json:"features"`
Defaults *VMessDefaultConfig `json:"default"`
DetourConfig *VMessDetourConfig `json:"detour"`
}
@ -89,8 +84,6 @@ func (c *VMessInboundConfig) Build() (proto.Message, error) {
if c.DetourConfig != nil {
config.Detour = c.DetourConfig.Build()
} else if c.Features != nil && c.Features.Detour != nil {
config.Detour = c.Features.Detour.Build()
}
config.User = make([]*protocol.User, len(c.Users))

View file

@ -48,21 +48,6 @@ var (
ctllog = log.New(os.Stderr, "xctl> ", 0)
)
func toProtocolList(s []string) ([]proxyman.KnownProtocols, error) {
kp := make([]proxyman.KnownProtocols, 0, 8)
for _, p := range s {
switch strings.ToLower(p) {
case "http":
kp = append(kp, proxyman.KnownProtocols_HTTP)
case "https", "tls", "ssl":
kp = append(kp, proxyman.KnownProtocols_TLS)
default:
return nil, errors.New("Unknown protocol: ", p)
}
}
return kp, nil
}
type SniffingConfig struct {
Enabled bool `json:"enabled"`
DestOverride *StringList `json:"destOverride"`
@ -175,7 +160,6 @@ type InboundDetourConfig struct {
Tag string `json:"tag"`
Allocation *InboundDetourAllocationConfig `json:"allocate"`
StreamSetting *StreamConfig `json:"streamSettings"`
DomainOverride *StringList `json:"domainOverride"`
SniffingConfig *SniffingConfig `json:"sniffing"`
}
@ -249,13 +233,6 @@ func (c *InboundDetourConfig) Build() (*core.InboundHandlerConfig, error) {
}
receiverSettings.SniffingSettings = s
}
if c.DomainOverride != nil {
kp, err := toProtocolList(*c.DomainOverride)
if err != nil {
return nil, errors.New("failed to parse inbound detour config").Base(err)
}
receiverSettings.DomainOverride = kp
}
settings := []byte("{}")
if c.Settings != nil {