1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-30 05:56:54 -05:00

add default settings for transport and security

This commit is contained in:
Shelikhoo 2021-09-05 10:02:05 +01:00
parent 98bf3dc79a
commit 3c94ff6a35
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316

View File

@ -17,6 +17,9 @@ func (s StreamConfig) BuildV5(ctx context.Context) (proto.Message, error) {
s.Security = "none"
}
if s.TransportSettings == nil {
s.TransportSettings = []byte("{}")
}
transportConfigPack, err := loadHeterogeneousConfigFromRawJson("transport", s.Transport, s.TransportSettings)
if err != nil {
return nil, newError("unable to load transport config").Base(err)
@ -28,6 +31,9 @@ func (s StreamConfig) BuildV5(ctx context.Context) (proto.Message, error) {
Settings: serial.ToTypedMessage(transportConfigPack),
})
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)