1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 09:36:34 -05:00

added special handling for none security

This commit is contained in:
Shelikhoo 2021-09-05 11:08:29 +01:00
parent 4ba76099e4
commit 8609a59322
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316

View File

@ -31,15 +31,17 @@ func (s StreamConfig) BuildV5(ctx context.Context) (proto.Message, error) {
Settings: serial.ToTypedMessage(transportConfigPack),
})
if s.SecuritySettings == nil {
s.SecuritySettings = []byte("{}")
if s.Security != "none" && s.Security != "" {
if s.SecuritySettings == nil {
s.SecuritySettings = []byte("{}")
}
securityConfigPack, err := loadHeterogeneousConfigFromRawJson("security", s.Security, s.SecuritySettings)
if err != nil {
return nil, newError("unable to load security config").Base(err)
}
config.SecurityType = s.Security
config.SecuritySettings = append(config.SecuritySettings, serial.ToTypedMessage(securityConfigPack))
}
securityConfigPack, err := loadHeterogeneousConfigFromRawJson("security", s.Security, s.SecuritySettings)
if err != nil {
return nil, newError("unable to load security config").Base(err)
}
config.SecurityType = s.Security
config.SecuritySettings = append(config.SecuritySettings, serial.ToTypedMessage(securityConfigPack))
config.SocketSettings, err = s.SocketSettings.Build()
if err != nil {