{"record":{"id":"ad3cf26c799a755d","repo":"XIU2/CloudflareSpeedTest","slug":"sl-tl-dn","errorCode":null,"errorMessage":"[提示] 在使用 [-sl] 参数时，建议搭配 [-tl] 参数，以避免因凑不够 [-dn] 数量而一直测速...","messagePattern":"\\[提示\\] 在使用 \\[-sl\\] 参数时，建议搭配 \\[-tl\\] 参数，以避免因凑不够 \\[-dn\\] 数量而一直测速\\.\\.\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"main.go","lineNumber":112,"sourceCode":"\tflag.Float64Var(&maxLossRate, \"tlr\", 1, \"丢包几率上限\")\n\tflag.Float64Var(&task.MinSpeed, \"sl\", 0, \"下载速度下限\")\n\n\tflag.IntVar(&utils.PrintNum, \"p\", 10, \"显示结果数量\")\n\tflag.StringVar(&task.IPFile, \"f\", \"ip.txt\", \"IP段数据文件\")\n\tflag.StringVar(&task.IPText, \"ip\", \"\", \"指定IP段数据\")\n\tflag.StringVar(&utils.Output, \"o\", \"result.csv\", \"输出结果文件\")\n\n\tflag.BoolVar(&task.Disable, \"dd\", false, \"禁用下载测速\")\n\tflag.BoolVar(&task.TestAll, \"allip\", false, \"测速全部 IP\")\n\n\tflag.BoolVar(&utils.Debug, \"debug\", false, \"调试输出模式\")\n\n\tflag.BoolVar(&printVersion, \"v\", false, \"打印程序版本\")\n\tflag.Usage = func() { fmt.Print(help) }\n\tflag.Parse()\n\n\tif task.MinSpeed > 0 && time.Duration(maxDelay)*time.Millisecond == utils.InputMaxDelay {\n\t\tutils.Yellow.Println(\"[提示] 在使用 [-sl] 参数时，建议搭配 [-tl] 参数，以避免因凑不够 [-dn] 数量而一直测速...\")\n\t}\n\tutils.InputMaxDelay = time.Duration(maxDelay) * time.Millisecond\n\tutils.InputMinDelay = time.Duration(minDelay) * time.Millisecond\n\tutils.InputMaxLossRate = float32(maxLossRate)\n\ttask.Timeout = time.Duration(downloadTime) * time.Second\n\ttask.HttpingCFColomap = task.MapColoMap()\n\n\tif printVersion {\n\t\tprintln(version)\n\t\tfmt.Println(\"检查版本更新中...\")\n\t\tcheckUpdate()\n\t\tif versionNew != \"\" {\n\t\t\tutils.Yellow.Printf(\"*** 发现新版本 [%s]！请前往 [https://github.com/XIU2/CloudflareSpeedTest] 更新！ ***\", versionNew)\n\t\t} else {\n\t\t\tutils.Green.Println(\"当前为最新版本 [\" + version + \"]！\")\n\t\t}\n\t\tos.Exit(0)\n\t}","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/XIU2/CloudflareSpeedTest/blob/1da0c025d7b6f9bf0b2b0cf47a547f65430deab2/main.go#L94-L130","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","If you truly want no delay filter, ignore the hint; it prints once and does not abort.","For scripting, always pass both bounds explicitly (-tl and -sl) so the message never appears and behavior is deterministic."],"exampleFix":"# before\n./cfst -sl 5\n# after\n./cfst -sl 5 -tl 200","handlingStrategy":"validation","validationCode":"# fail fast in wrappers when -sl is set without -tl\nprintf '%s\\n' \"$@\" | grep -q -- '-sl ' || exit 0\nprintf '%s\\n' \"$@\" | grep -q -- '-tl ' || { echo 'ERROR: -sl requires -tl'; exit 1; }\n./cfst \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always script -tl and -sl together so queue pre-filtering bounds the run.","Pin both bounds in a saved command instead of retyping ad hoc flags."],"tags":["go","cli","startup-hint","flags"],"backgroundTag":null,"analyzedSha":"1da0c025d7b6f9bf0b2b0cf47a547f65430deab2","analyzedAt":"2026-08-15T22:22:10.737Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}