2016-10-12 16:46:02 +02:00
|
|
|
package core
|
2015-10-06 23:11:08 +02:00
|
|
|
|
2015-11-21 21:43:40 +01:00
|
|
|
import (
|
2016-10-16 00:46:08 +02:00
|
|
|
"v2ray.com/core/common"
|
2016-10-17 14:35:13 +02:00
|
|
|
v2net "v2ray.com/core/common/net"
|
2015-11-21 21:43:40 +01:00
|
|
|
)
|
|
|
|
|
2016-10-14 22:21:45 +02:00
|
|
|
func (this *AllocationStrategyConcurrency) GetValue() uint32 {
|
|
|
|
if this == nil {
|
|
|
|
return 3
|
|
|
|
}
|
|
|
|
return this.Value
|
2015-12-28 23:17:38 +01:00
|
|
|
}
|
|
|
|
|
2016-10-14 22:21:45 +02:00
|
|
|
func (this *AllocationStrategyRefresh) GetValue() uint32 {
|
|
|
|
if this == nil {
|
|
|
|
return 5
|
|
|
|
}
|
|
|
|
return this.Value
|
2015-10-31 14:08:13 +01:00
|
|
|
}
|
|
|
|
|
2016-10-14 22:21:45 +02:00
|
|
|
func (this *InboundConnectionConfig) GetAllocationStrategyValue() *AllocationStrategy {
|
|
|
|
if this.AllocationStrategy == nil {
|
|
|
|
return &AllocationStrategy{}
|
|
|
|
}
|
|
|
|
return this.AllocationStrategy
|
2015-11-13 23:43:58 +01:00
|
|
|
}
|
|
|
|
|
2016-10-17 14:35:13 +02:00
|
|
|
func (this *InboundConnectionConfig) GetListenOnValue() v2net.Address {
|
|
|
|
if this.GetListenOn() == nil {
|
|
|
|
return v2net.AnyIP
|
|
|
|
}
|
|
|
|
return this.ListenOn.AsAddress()
|
|
|
|
}
|
|
|
|
|
2016-10-14 22:21:45 +02:00
|
|
|
func (this *InboundConnectionConfig) GetTypedSettings() (interface{}, error) {
|
2016-10-16 00:46:08 +02:00
|
|
|
if this.GetSettings() == nil {
|
|
|
|
return nil, common.ErrBadConfiguration
|
|
|
|
}
|
|
|
|
return this.GetSettings().GetInstance()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *OutboundConnectionConfig) GetTypedSettings() (interface{}, error) {
|
|
|
|
if this.GetSettings() == nil {
|
|
|
|
return nil, common.ErrBadConfiguration
|
|
|
|
}
|
|
|
|
return this.GetSettings().GetInstance()
|
2016-01-17 21:43:10 +01:00
|
|
|
}
|
2016-10-18 00:02:41 +02:00
|
|
|
|
|
|
|
func (this *OutboundConnectionConfig) GetSendThroughValue() v2net.Address {
|
|
|
|
if this.GetSendThrough() == nil {
|
|
|
|
return v2net.AnyIP
|
|
|
|
}
|
|
|
|
return this.SendThrough.AsAddress()
|
|
|
|
}
|