mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-12-31 06:25:32 -05:00
support security = "auto"
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package protocol
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
v2net "v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/uuid"
|
||||
)
|
||||
@@ -87,3 +89,16 @@ type CommandSwitchAccount struct {
|
||||
Level uint32
|
||||
ValidMin byte
|
||||
}
|
||||
|
||||
func (v *SecurityConfig) AsSecurity() Security {
|
||||
if v == nil {
|
||||
return Security(SecurityType_LEGACY)
|
||||
}
|
||||
if v.Type == SecurityType_AUTO {
|
||||
if runtime.GOARCH == "amd64" || runtime.GOARCH == "s390x" {
|
||||
return Security(SecurityType_AES128_GCM)
|
||||
}
|
||||
return Security(SecurityType_CHACHA20_POLY1305)
|
||||
}
|
||||
return Security(v.Type)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user