mirror of https://github.com/v2ray/v2ray-core
parent
3f54bf3f53
commit
36ce56c524
|
@ -23,22 +23,22 @@ func CreateTransportConfig(protocol TransportProtocol) (interface{}, error) {
|
||||||
return creator(), nil
|
return creator(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *TransportConfig) GetTypedSettings() (interface{}, error) {
|
func (c *TransportConfig) GetTypedSettings() (interface{}, error) {
|
||||||
return v.Settings.GetInstance()
|
return c.Settings.GetInstance()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *StreamConfig) GetEffectiveProtocol() TransportProtocol {
|
func (c *StreamConfig) GetEffectiveProtocol() TransportProtocol {
|
||||||
if v == nil {
|
if c == nil {
|
||||||
return TransportProtocol_TCP
|
return TransportProtocol_TCP
|
||||||
}
|
}
|
||||||
return v.Protocol
|
return c.Protocol
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *StreamConfig) GetEffectiveTransportSettings() (interface{}, error) {
|
func (c *StreamConfig) GetEffectiveTransportSettings() (interface{}, error) {
|
||||||
protocol := v.GetEffectiveProtocol()
|
protocol := c.GetEffectiveProtocol()
|
||||||
|
|
||||||
if v != nil {
|
if c != nil {
|
||||||
for _, settings := range v.TransportSettings {
|
for _, settings := range c.TransportSettings {
|
||||||
if settings.Protocol == protocol {
|
if settings.Protocol == protocol {
|
||||||
return settings.GetTypedSettings()
|
return settings.GetTypedSettings()
|
||||||
}
|
}
|
||||||
|
@ -71,17 +71,17 @@ func (c *StreamConfig) GetTransportSettingsFor(protocol TransportProtocol) (inte
|
||||||
return CreateTransportConfig(protocol)
|
return CreateTransportConfig(protocol)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *StreamConfig) GetEffectiveSecuritySettings() (interface{}, error) {
|
func (c *StreamConfig) GetEffectiveSecuritySettings() (interface{}, error) {
|
||||||
for _, settings := range v.SecuritySettings {
|
for _, settings := range c.SecuritySettings {
|
||||||
if settings.Type == v.SecurityType {
|
if settings.Type == c.SecurityType {
|
||||||
return settings.GetInstance()
|
return settings.GetInstance()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return serial.GetInstance(v.SecurityType)
|
return serial.GetInstance(c.SecurityType)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *StreamConfig) HasSecuritySettings() bool {
|
func (c *StreamConfig) HasSecuritySettings() bool {
|
||||||
return len(v.SecurityType) > 0
|
return len(c.SecurityType) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func ApplyGlobalTransportSettings(settings []*TransportConfig) error {
|
func ApplyGlobalTransportSettings(settings []*TransportConfig) error {
|
||||||
|
@ -89,6 +89,6 @@ func ApplyGlobalTransportSettings(settings []*TransportConfig) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *ProxyConfig) HasTag() bool {
|
func (c *ProxyConfig) HasTag() bool {
|
||||||
return v != nil && len(v.Tag) > 0
|
return c != nil && len(c.Tag) > 0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue