v2ray-core/config.go

56 lines
1.2 KiB
Go
Raw Normal View History

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