{"record":{"id":"e1de18a2f6cc8011","repo":"XIU2/CloudflareSpeedTest","slug":"ip-s-v-s-e1de18","errorCode":null,"errorMessage":"[调试] IP: %s, 延迟测速失败，错误信息: %v, 测速地址: %s","messagePattern":"\\[调试\\] IP: (.+?), 延迟测速失败，错误信息: (.+?), 测速地址: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"task/httping.go","lineNumber":56,"sourceCode":"\t\t},\n\t}\n\tdefer hc.CloseIdleConnections()\n\n\t// 先访问一次获得 HTTP 状态码 及 地区码\n\tvar colo string\n\t{\n\t\trequest, err := http.NewRequest(http.MethodHead, URL, nil)\n\t\tif err != nil {\n\t\t\tif utils.Debug { // 调试模式下，输出更多信息\n\t\t\t\tutils.Red.Printf(\"[调试] IP: %s, 延迟测速请求创建失败，错误信息: %v, 测速地址: %s\\n\", ip.String(), err, URL)\n\t\t\t}\n\t\t\treturn 0, 0, \"\"\n\t\t}\n\t\trequest.Header.Set(\"User-Agent\", \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36\")\n\t\tresponse, err := hc.Do(request)\n\t\tif err != nil {\n\t\t\tif utils.Debug { // 调试模式下，输出更多信息\n\t\t\t\tutils.Red.Printf(\"[调试] IP: %s, 延迟测速失败，错误信息: %v, 测速地址: %s\\n\", ip.String(), err, URL)\n\t\t\t}\n\t\t\treturn 0, 0, \"\"\n\t\t}\n\t\tdefer response.Body.Close()\n\n\t\t//fmt.Println(\"IP:\", ip, \"StatusCode:\", response.StatusCode, response.Request.URL)\n\t\t// 如果未指定的 HTTP 状态码，或指定的状态码不合规，则默认只认为 200、301、302 才算 HTTPing 通过\n\t\tif HttpingStatusCode == 0 || HttpingStatusCode < 100 && HttpingStatusCode > 599 {\n\t\t\tif response.StatusCode != 200 && response.StatusCode != 301 && response.StatusCode != 302 {\n\t\t\t\tif utils.Debug { // 调试模式下，输出更多信息\n\t\t\t\t\tutils.Red.Printf(\"[调试] IP: %s, 延迟测速终止，HTTP 状态码: %d, 测速地址: %s\\n\", ip.String(), response.StatusCode, URL)\n\t\t\t\t}\n\t\t\t\treturn 0, 0, \"\"\n\t\t\t}\n\t\t} else {\n\t\t\tif response.StatusCode != HttpingStatusCode {\n\t\t\t\tif utils.Debug { // 调试模式下，输出更多信息\n\t\t\t\t\tutils.Red.Printf(\"[调试] IP: %s, 延迟测速终止，HTTP 状态码: %d, 指定的 HTTP 状态码 %d, 测速地址: %s\\n\", ip.String(), response.StatusCode, HttpingStatusCode, URL)","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/XIU2/CloudflareSpeedTest/blob/1da0c025d7b6f9bf0b2b0cf47a547f65430deab2/task/httping.go#L38-L74","documentation":"Debug branch in task/httping.go:53-59: the HTTP client's Do() failed during the initial HTTPing probe, so the IP scores 0 and is filtered out. The client (httping.go:30-39) has a hard 2-second timeout, dials the candidate IP via getDialContext on TCPPort, and forbids redirects, so this covers connect/TLS timeouts, resets, and refused connections. It is an expected per-IP outcome, not a program bug; healthy runs surface it only in -debug mode.","triggerScenarios":"Any candidate IP that cannot complete TCP+TLS to TCPPort (443 default) within 2 s: dead IPs from a stale ip.txt, a local network/ISP that blocks outbound 443 to those ranges, a -url host whose certificate fails validation, or -tp pointing at a closed port. It also fires when the -url server resets HEAD requests.","commonSituations":"Residential networks throttling or RST-ing CDN traffic; corporate firewalls blocking direct-to-IP TLS (SNI/IP mismatch); stale IP ranges after Cloudflare renumbering; -tp 2053/2083/2087/2096/8443 style ports not actually open on the tested IP.","solutions":["Re-run with -debug and check whether ALL IPs fail (points to local network/-url/-tp problems) or only some (normal dead IPs).","Verify basic reachability of one IP: curl --resolve speed.example.com:443:104.16.1.1 https://speed.example.com/ or a TCP ping.","If everything fails, change -tp to a port your network allows (443 is safest) or test from another network.","Refresh ip.txt from a current Cloudflare ranges source so the pool contains live IPs."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"# pre-flight one representative IP before a long run\ncurl -sI --max-time 3 --resolve speed.example.com:443:104.16.1.1 \\\n  https://speed.example.com/ >/dev/null && echo ok || echo \"egress to 443 blocked\"","typeGuard":null,"tryCatchPattern":"// per-IP: treat Do() failure as skip-and-move-on (as upstream does),\n// optionally with one retry before scoring the IP as 0.\nfor attempt := 0; attempt < 2; attempt++ {\n\tif resp, err := hc.Do(req); err == nil {\n\t\tresp.Body.Close()\n\t\tbreak\n\t}\n}","preventionTips":["Expect partial failures: dead IPs are normal; only all-IP failure indicates local blocking.","Refresh ip.txt regularly so the pool has live IPs.","Confirm -tp is open on your network before testing that port."],"tags":["go","httping","network","timeout","debug-output"],"backgroundTag":null,"analyzedSha":"1da0c025d7b6f9bf0b2b0cf47a547f65430deab2","analyzedAt":"2026-08-15T22:22:10.737Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}