2018-09-07 08:50:25 -04:00
|
|
|
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,
|
2018-09-07 08:56:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if s != nil {
|
|
|
|
mss.SocketSettings = s.SocketSettings
|
2018-09-07 08:50:25 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|