1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-07-17 18:54:14 -04:00
v2fly/config.go

56 lines
1.2 KiB
Go
Raw Normal View History

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