You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
v2ray-core/config.go

56 lines
1.2 KiB

8 years ago
package core
import (
8 years ago
"v2ray.com/core/common"
v2net "v2ray.com/core/common/net"
)
func (v *AllocationStrategy) GetConcurrencyValue() uint32 {
if v == nil || v.Concurrency == nil {
return 3
}
return v.Concurrency.Value
}
func (v *AllocationStrategy) GetRefreshValue() uint32 {
if v == nil || v.Refresh == nil {
return 5
}
return v.Refresh.Value
9 years ago
}
8 years ago
func (v *InboundConnectionConfig) GetAllocationStrategyValue() *AllocationStrategy {
if v.AllocationStrategy == nil {
return &AllocationStrategy{}
}
8 years ago
return v.AllocationStrategy
}
8 years ago
func (v *InboundConnectionConfig) GetListenOnValue() v2net.Address {
if v.GetListenOn() == nil {
return v2net.AnyIP
}
8 years ago
return v.ListenOn.AsAddress()
}
8 years ago
func (v *InboundConnectionConfig) GetTypedSettings() (interface{}, error) {
if v.GetSettings() == nil {
8 years ago
return nil, common.ErrBadConfiguration
}
8 years ago
return v.GetSettings().GetInstance()
8 years ago
}
8 years ago
func (v *OutboundConnectionConfig) GetTypedSettings() (interface{}, error) {
if v.GetSettings() == nil {
8 years ago
return nil, common.ErrBadConfiguration
}
8 years ago
return v.GetSettings().GetInstance()
}
8 years ago
func (v *OutboundConnectionConfig) GetSendThroughValue() v2net.Address {
if v.GetSendThrough() == nil {
return v2net.AnyIP
}
8 years ago
return v.SendThrough.AsAddress()
}