mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-01-08 10:15:53 -05:00
settings for forcing secure encryption in vmess server
This commit is contained in:
@@ -38,24 +38,11 @@ const (
|
||||
RequestOptionChunkMasking bitmask.Byte = 0x04
|
||||
)
|
||||
|
||||
type Security byte
|
||||
|
||||
func (s Security) Is(t SecurityType) bool {
|
||||
return s == Security(t)
|
||||
}
|
||||
|
||||
func NormSecurity(s Security) Security {
|
||||
if s.Is(SecurityType_UNKNOWN) {
|
||||
return Security(SecurityType_LEGACY)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
type RequestHeader struct {
|
||||
Version byte
|
||||
Command RequestCommand
|
||||
Option bitmask.Byte
|
||||
Security Security
|
||||
Security SecurityType
|
||||
Port net.Port
|
||||
Address net.Address
|
||||
User *User
|
||||
@@ -88,14 +75,14 @@ type CommandSwitchAccount struct {
|
||||
ValidMin byte
|
||||
}
|
||||
|
||||
func (sc *SecurityConfig) AsSecurity() Security {
|
||||
func (sc *SecurityConfig) GetSecurityType() SecurityType {
|
||||
if sc == nil || sc.Type == SecurityType_AUTO {
|
||||
if runtime.GOARCH == "amd64" || runtime.GOARCH == "s390x" {
|
||||
return Security(SecurityType_AES128_GCM)
|
||||
return SecurityType_AES128_GCM
|
||||
}
|
||||
return Security(SecurityType_CHACHA20_POLY1305)
|
||||
return SecurityType_CHACHA20_POLY1305
|
||||
}
|
||||
return NormSecurity(Security(sc.Type))
|
||||
return sc.Type
|
||||
}
|
||||
|
||||
func IsDomainTooLong(domain string) bool {
|
||||
|
||||
Reference in New Issue
Block a user