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-11-27 20:39:09 +00:00
func (v *AllocationStrategyConcurrency) GetValue() uint32 {
if v == nil {
2016-10-14 20:21:45 +00:00
return 3
}
2016-11-27 20:39:09 +00:00
return v.Value
2015-12-28 22:17:38 +00:00
}
2016-11-27 20:39:09 +00:00
func (v *AllocationStrategyRefresh) GetValue() uint32 {
if v == nil {
2016-10-14 20:21:45 +00:00
return 5
}
2016-11-27 20:39:09 +00:00
return v.Value
2015-10-31 13:08:13 +00:00
}
2016-11-27 20:39:09 +00:00
func (v *InboundConnectionConfig) GetAllocationStrategyValue() *AllocationStrategy {
if v.AllocationStrategy == nil {
2016-10-14 20:21:45 +00:00
return &AllocationStrategy{}
}
2016-11-27 20:39:09 +00:00
return v.AllocationStrategy
2015-11-13 22:43:58 +00:00
}
2016-11-27 20:39:09 +00:00
func (v *InboundConnectionConfig) GetListenOnValue() v2net.Address {
if v.GetListenOn() == nil {
2016-10-17 12:35:13 +00:00
return v2net.AnyIP
}
2016-11-27 20:39:09 +00:00
return v.ListenOn.AsAddress()
2016-10-17 12:35:13 +00:00
}
2016-11-27 20:39:09 +00:00
func (v *InboundConnectionConfig) GetTypedSettings() (interface{}, error) {
if v.GetSettings() == nil {
2016-10-15 22:46:08 +00:00
return nil, common.ErrBadConfiguration
}
2016-11-27 20:39:09 +00:00
return v.GetSettings().GetInstance()
2016-10-15 22:46:08 +00:00
}
2016-11-27 20:39:09 +00:00
func (v *OutboundConnectionConfig) GetTypedSettings() (interface{}, error) {
if v.GetSettings() == nil {
2016-10-15 22:46:08 +00:00
return nil, common.ErrBadConfiguration
}
2016-11-27 20:39:09 +00:00
return v.GetSettings().GetInstance()
2016-01-17 20:43:10 +00:00
}
2016-10-17 22:02:41 +00:00
2016-11-27 20:39:09 +00:00
func (v *OutboundConnectionConfig) GetSendThroughValue() v2net.Address {
if v.GetSendThrough() == nil {
2016-10-17 22:02:41 +00:00
return v2net.AnyIP
}
2016-11-27 20:39:09 +00:00
return v.SendThrough.AsAddress()
2016-10-17 22:02:41 +00:00
}