mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
737 B
37 lines
737 B
package internet
|
|
|
|
type MemoryStreamConfig struct {
|
|
ProtocolName string
|
|
ProtocolSettings interface{}
|
|
SecurityType string
|
|
SecuritySettings interface{}
|
|
SocketSettings *SocketConfig
|
|
}
|
|
|
|
func ToMemoryStreamConfig(s *StreamConfig) (*MemoryStreamConfig, error) {
|
|
ets, err := s.GetEffectiveTransportSettings()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
mss := &MemoryStreamConfig{
|
|
ProtocolName: s.GetEffectiveProtocol(),
|
|
ProtocolSettings: ets,
|
|
}
|
|
|
|
if s != nil {
|
|
mss.SocketSettings = s.SocketSettings
|
|
}
|
|
|
|
if s != nil && s.HasSecuritySettings() {
|
|
ess, err := s.GetEffectiveSecuritySettings()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
mss.SecurityType = s.SecurityType
|
|
mss.SecuritySettings = ess
|
|
}
|
|
|
|
return mss, nil
|
|
}
|