Documentation
¶
Index ¶
Constants ¶
View Source
const ( StrategyIntranet = "IL" // 内网限制 StrategyWhite = "WL" // 白名单 StrategyBlack = "BL" // 黑名单 )
View Source
const NetworkTcp = Network(Tcp)
View Source
const NetworkUdp = Network(Udp)
Variables ¶
View Source
var DefaultPingTime time.Duration = 10000
Functions ¶
func DefaultValue ¶
DefaultValue is a generic function that returns either a value or a default based on a boolean condition It uses Go's generics feature to work with any type T
Parameters:
b: boolean condition to determine which value to return val: the value to return if b is true def: the default value to return if b is false
Returns:
T: either val or def based on the boolean condition b
func IsNotNil ¶
func IsNotNil[T comparable](value T) bool
func NilDefault ¶
func NilDefault[T comparable](value T, defaultValue T) T
NilDefault NilDefault[T comparable]
@Description: @param value @param defaultValue @return T
func NumberDefault ¶
func NumberDefault[T Number](value T, defaultValue T) T
NumberDefault NumberDefault[T Number]
@Description: If value not eq 0 return value, if not defaultValue. @param value @param defaultValue @return T
Types ¶
type TunnelType ¶
type TunnelType string
const ( Http TunnelType = "http" Https TunnelType = "https" Tcp TunnelType = "tcp" Udp TunnelType = "udp" )
Click to show internal directories.
Click to hide internal directories.