XIU2/CloudflareSpeedTest · info

[提示] 在使用 [-sl] 参数时,建议搭配 [-tl] 参数,以避免因凑不够 [-dn] 数量而一直测速...

Error message

[提示] 在使用 [-sl] 参数时,建议搭配 [-tl] 参数,以避免因凑不够 [-dn] 数量而一直测速...

What it means

This is a startup hint, not a runtime failure. main.go:111 fires when -sl (download speed lower bound) is set > 0 while -tl (average delay upper bound) is still the default 9999 ms (time.Duration(maxDelay)*time.Millisecond == utils.InputMaxDelay). With -sl active, TestDownloadSpeed keeps testing the whole queue until it collects -dn IPs above the speed bound, so without a delay cap the run can grind through every candidate IP.

Source

Thrown at main.go:112

	flag.Float64Var(&maxLossRate, "tlr", 1, "丢包几率上限")
	flag.Float64Var(&task.MinSpeed, "sl", 0, "下载速度下限")

	flag.IntVar(&utils.PrintNum, "p", 10, "显示结果数量")
	flag.StringVar(&task.IPFile, "f", "ip.txt", "IP段数据文件")
	flag.StringVar(&task.IPText, "ip", "", "指定IP段数据")
	flag.StringVar(&utils.Output, "o", "result.csv", "输出结果文件")

	flag.BoolVar(&task.Disable, "dd", false, "禁用下载测速")
	flag.BoolVar(&task.TestAll, "allip", false, "测速全部 IP")

	flag.BoolVar(&utils.Debug, "debug", false, "调试输出模式")

	flag.BoolVar(&printVersion, "v", false, "打印程序版本")
	flag.Usage = func() { fmt.Print(help) }
	flag.Parse()

	if task.MinSpeed > 0 && time.Duration(maxDelay)*time.Millisecond == utils.InputMaxDelay {
		utils.Yellow.Println("[提示] 在使用 [-sl] 参数时,建议搭配 [-tl] 参数,以避免因凑不够 [-dn] 数量而一直测速...")
	}
	utils.InputMaxDelay = time.Duration(maxDelay) * time.Millisecond
	utils.InputMinDelay = time.Duration(minDelay) * time.Millisecond
	utils.InputMaxLossRate = float32(maxLossRate)
	task.Timeout = time.Duration(downloadTime) * time.Second
	task.HttpingCFColomap = task.MapColoMap()

	if printVersion {
		println(version)
		fmt.Println("检查版本更新中...")
		checkUpdate()
		if versionNew != "" {
			utils.Yellow.Printf("*** 发现新版本 [%s]!请前往 [https://github.com/XIU2/CloudflareSpeedTest] 更新! ***", versionNew)
		} else {
			utils.Green.Println("当前为最新版本 [" + version + "]!")
		}
		os.Exit(0)
	}

View on GitHub (pinned to 1da0c025d7)

Solutions

  1. Add a delay cap alongside the speed bound, e.g. -sl 5 -tl 200, so the queue is pre-filtered and -dn can actually be satisfied.
  2. If you truly want no delay filter, ignore the hint; it prints once and does not abort.
  3. For scripting, always pass both bounds explicitly (-tl and -sl) so the message never appears and behavior is deterministic.

Example fix

# before
./cfst -sl 5
# after
./cfst -sl 5 -tl 200
Defensive patterns

Strategy: validation

Validate before calling

# fail fast in wrappers when -sl is set without -tl
printf '%s\n' "$@" | grep -q -- '-sl ' || exit 0
printf '%s\n' "$@" | grep -q -- '-tl ' || { echo 'ERROR: -sl requires -tl'; exit 1; }
./cfst "$@"

Prevention

When it happens

Trigger: Running the binary with -sl 5 (or any positive value) and no explicit -tl. The comparison at main.go:111 is true only because maxDelay still holds the flag default 9999, so any -tl you pass yourself suppresses the hint.

Common situations: New users copying a command like ./cfst -sl 5 from a tutorial without the matching -tl 200; scripted runs that only set speed criteria and then appear to hang on slow networks.

Related errors


AI-assisted analysis of XIU2/CloudflareSpeedTest@1da0c025d7 (2026-08-15). Data as JSON: /api/errors/ad3cf26c799a755d. Report an issue: GitHub.