config

package
v1.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultRoutines 默认线程数
	DefaultRoutines int = 200
	// DefaultPingTimes 默认ping次数
	DefaultPingTimes int = 4
	// DefaultTestCount 下载测速节点数量
	DefaultTestCount int = 10
	// DefaultDownloadTime 下载测速时间
	DefaultDownloadTime time.Duration = 10 * time.Second
	// DefaultTimeout 下载超时时间
	DefaultTimeout = DefaultDownloadTime
	// DefaultTCPPort 测速端口
	DefaultTCPPort int = 443
	// DefaultDownloadURL 测速地址
	DefaultDownloadURL string = "https://cloudflarest.gssmc.cf/100mb.zip"
	// DefaultHttpingMode 切换测速模式
	DefaultHttpingMode bool = false
	// DefaultHttpingStatusCode 有效状态代码
	DefaultHttpingStatusCode int = 0
	// DefaultHttpingCFColo 匹配指定区域
	DefaultHttpingCFColo string = ""
	// DefaultMaxDelay 平均延迟上限
	DefaultMaxDelay time.Duration = 9999 * time.Millisecond
	// DefaultMinDelay 平均延迟下限
	DefaultMinDelay time.Duration = 0 * time.Millisecond
	// DefaultMaxLossRate 丢包几率上限
	DefaultMaxLossRate float32 = 1
	// DefaultMinSpeed 下载速度下限
	DefaultMinSpeed float64 = 0
	// DefaultIPsArev6 测试的ip是v6
	DefaultIPsArev6 bool = false
	// DefaultDisableDownload 禁用下载测速
	DefaultDisableDownload bool = false
	// DefaultTestAllIP 测试所有ip
	DefaultTestAllIP bool = false
	// DefaultEnableIPBanCheck  默认不开启ip ban检测
	DefaultEnableIPBanCheck bool = false
)

Variables

View Source
var DefaultIpBanChecker = func(some any) any {
	return some
}
View Source
var DefaultWantedISOIP []string

Functions

func MapColoMap

func MapColoMap(coloStrs string) *sync.Map

func NewTestOptions

func NewTestOptions(opt ...TestOptionFunc) entity.TestOptions

Types

type TestOptionFunc

type TestOptionFunc func(*entity.TestOptions)

func WithDisableDownload

func WithDisableDownload(disableDownload bool) TestOptionFunc

func WithDownloadTime

func WithDownloadTime(downloadTime time.Duration) TestOptionFunc

func WithDownloadUrl

func WithDownloadUrl(downloadUrl string) TestOptionFunc

func WithEnableIPBanCheck

func WithEnableIPBanCheck(enableIPBanCheck bool) TestOptionFunc

func WithHttpingCFColo

func WithHttpingCFColo(httpingCFColo string) TestOptionFunc

func WithHttpingMode

func WithHttpingMode(httpingMode bool) TestOptionFunc

func WithHttpingStatusCode

func WithHttpingStatusCode(httpingStatusCode int) TestOptionFunc

func WithIPBanChecker

func WithIPBanChecker(ipBanCheckerFunc func(some any) any) TestOptionFunc

func WithIPListForTest

func WithIPListForTest(ipListForTest []*net.IPAddr) TestOptionFunc

func WithIPsArev6

func WithIPsArev6(ipsArev6 bool) TestOptionFunc

func WithMaxDelay

func WithMaxDelay(maxDelay time.Duration) TestOptionFunc

func WithMaxLossRate

func WithMaxLossRate(maxLossRate float32) TestOptionFunc

func WithMinDelay

func WithMinDelay(minDelay time.Duration) TestOptionFunc

func WithMinSpeed

func WithMinSpeed(minSpeed float64) TestOptionFunc

func WithPingTimes

func WithPingTimes(pingTimes int) TestOptionFunc

func WithRoutines

func WithRoutines(routines int) TestOptionFunc

WithRoutines

@Description: 设置延迟测速线程
@param routines
@return TestOptionFunc

func WithTCPPort

func WithTCPPort(tcpPort int) TestOptionFunc

func WithTestAllIP

func WithTestAllIP(testAllIP bool) TestOptionFunc

func WithTestCount

func WithTestCount(testCount int) TestOptionFunc

func WithTimeout

func WithTimeout(timeout time.Duration) TestOptionFunc

func WithWantedISOIP

func WithWantedISOIP(wantedISOIP []string) TestOptionFunc

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL