mirror of https://github.com/v2ray/v2ray-core
34 lines
716 B
Go
34 lines
716 B
Go
![]() |
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,
|
||
|
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
|
||
|
}
|