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
|
||||
}
|
||||
|
||||
func (v *TransportConfig) GetTypedSettings() (interface{}, error) {
|
||||
return v.Settings.GetInstance()
|
||||
func (c *TransportConfig) GetTypedSettings() (interface{}, error) {
|
||||
return c.Settings.GetInstance()
|
||||
}
|
||||
|
||||
func (v *StreamConfig) GetEffectiveProtocol() TransportProtocol {
|
||||
if v == nil {
|
||||
func (c *StreamConfig) GetEffectiveProtocol() TransportProtocol {
|
||||
if c == nil {
|
||||
return TransportProtocol_TCP
|
||||
}
|
||||
return v.Protocol
|
||||
return c.Protocol
|
||||
}
|
||||
|
||||
func (v *StreamConfig) GetEffectiveTransportSettings() (interface{}, error) {
|
||||
protocol := v.GetEffectiveProtocol()
|
||||
func (c *StreamConfig) GetEffectiveTransportSettings() (interface{}, error) {
|
||||
protocol := c.GetEffectiveProtocol()
|
||||
|
||||
if v != nil {
|
||||
for _, settings := range v.TransportSettings {
|
||||
if c != nil {
|
||||
for _, settings := range c.TransportSettings {
|
||||
if settings.Protocol == protocol {
|
||||
return settings.GetTypedSettings()
|
||||
}
|
||||
|
@ -71,17 +71,17 @@ func (c *StreamConfig) GetTransportSettingsFor(protocol TransportProtocol) (inte
|
|||
return CreateTransportConfig(protocol)
|
||||
}
|
||||
|
||||
func (v *StreamConfig) GetEffectiveSecuritySettings() (interface{}, error) {
|
||||
for _, settings := range v.SecuritySettings {
|
||||
if settings.Type == v.SecurityType {
|
||||
func (c *StreamConfig) GetEffectiveSecuritySettings() (interface{}, error) {
|
||||
for _, settings := range c.SecuritySettings {
|
||||
if settings.Type == c.SecurityType {
|
||||
return settings.GetInstance()
|
||||
}
|
||||
}
|
||||
return serial.GetInstance(v.SecurityType)
|
||||
return serial.GetInstance(c.SecurityType)
|
||||
}
|
||||
|
||||
func (v *StreamConfig) HasSecuritySettings() bool {
|
||||
return len(v.SecurityType) > 0
|
||||
func (c *StreamConfig) HasSecuritySettings() bool {
|
||||
return len(c.SecurityType) > 0
|
||||
}
|
||||
|
||||
func ApplyGlobalTransportSettings(settings []*TransportConfig) error {
|
||||
|
@ -89,6 +89,6 @@ func ApplyGlobalTransportSettings(settings []*TransportConfig) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (v *ProxyConfig) HasTag() bool {
|
||||
return v != nil && len(v.Tag) > 0
|
||||
func (c *ProxyConfig) HasTag() bool {
|
||||
return c != nil && len(c.Tag) > 0
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue