Clean legacy vmess (#2199)

* Remove legacy Vmess

* validators

* protos
This commit is contained in:
yuhan6665 2023-06-12 10:32:25 -04:00 committed by GitHub
parent bf4b1fab3c
commit 9112cfd39c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 150 additions and 761 deletions

View file

@ -15,7 +15,6 @@ import (
type VMessAccount struct {
ID string `json:"id"`
AlterIds uint16 `json:"alterId"`
Security string `json:"security"`
Experiments string `json:"experiments"`
}
@ -39,7 +38,6 @@ func (a *VMessAccount) Build() *vmess.Account {
}
return &vmess.Account{
Id: a.ID,
AlterId: uint32(a.AlterIds),
SecuritySettings: &protocol.SecurityConfig{
Type: st,
},
@ -63,14 +61,12 @@ type FeaturesConfig struct {
}
type VMessDefaultConfig struct {
AlterIDs uint16 `json:"alterId"`
Level byte `json:"level"`
}
// Build implements Buildable
func (c *VMessDefaultConfig) Build() *inbound.DefaultConfig {
config := new(inbound.DefaultConfig)
config.AlterId = uint32(c.AlterIDs)
config.Level = uint32(c.Level)
return config
}
@ -80,14 +76,11 @@ type VMessInboundConfig struct {
Features *FeaturesConfig `json:"features"`
Defaults *VMessDefaultConfig `json:"default"`
DetourConfig *VMessDetourConfig `json:"detour"`
SecureOnly bool `json:"disableInsecureEncryption"`
}
// Build implements Buildable
func (c *VMessInboundConfig) Build() (proto.Message, error) {
config := &inbound.Config{
SecureEncryptionOnly: c.SecureOnly,
}
config := &inbound.Config{}
if c.Defaults != nil {
config.Default = c.Defaults.Build()

View file

@ -105,7 +105,6 @@ func TestVMessInbound(t *testing.T) {
Detour: &inbound.DetourConfig{
To: "tag_to_detour",
},
SecureEncryptionOnly: true,
},
},
})