XIU2/CloudflareSpeedTest · warning

[调试] IP: %s, 延迟测速失败,错误信息: %v, 测速地址: %s

Error message

[调试] IP: %s, 延迟测速失败,错误信息: %v, 测速地址: %s

What it means

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.

Source

Thrown at task/httping.go:56

		},
	}
	defer hc.CloseIdleConnections()

	// 先访问一次获得 HTTP 状态码 及 地区码
	var colo string
	{
		request, err := http.NewRequest(http.MethodHead, URL, nil)
		if err != nil {
			if utils.Debug { // 调试模式下,输出更多信息
				utils.Red.Printf("[调试] IP: %s, 延迟测速请求创建失败,错误信息: %v, 测速地址: %s\n", ip.String(), err, URL)
			}
			return 0, 0, ""
		}
		request.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")
		response, err := hc.Do(request)
		if err != nil {
			if utils.Debug { // 调试模式下,输出更多信息
				utils.Red.Printf("[调试] IP: %s, 延迟测速失败,错误信息: %v, 测速地址: %s\n", ip.String(), err, URL)
			}
			return 0, 0, ""
		}
		defer response.Body.Close()

		//fmt.Println("IP:", ip, "StatusCode:", response.StatusCode, response.Request.URL)
		// 如果未指定的 HTTP 状态码,或指定的状态码不合规,则默认只认为 200、301、302 才算 HTTPing 通过
		if HttpingStatusCode == 0 || HttpingStatusCode < 100 && HttpingStatusCode > 599 {
			if response.StatusCode != 200 && response.StatusCode != 301 && response.StatusCode != 302 {
				if utils.Debug { // 调试模式下,输出更多信息
					utils.Red.Printf("[调试] IP: %s, 延迟测速终止,HTTP 状态码: %d, 测速地址: %s\n", ip.String(), response.StatusCode, URL)
				}
				return 0, 0, ""
			}
		} else {
			if response.StatusCode != HttpingStatusCode {
				if utils.Debug { // 调试模式下,输出更多信息
					utils.Red.Printf("[调试] IP: %s, 延迟测速终止,HTTP 状态码: %d, 指定的 HTTP 状态码 %d, 测速地址: %s\n", ip.String(), response.StatusCode, HttpingStatusCode, URL)

View on GitHub (pinned to 1da0c025d7)

Solutions

  1. Re-run with -debug and check whether ALL IPs fail (points to local network/-url/-tp problems) or only some (normal dead IPs).
  2. Verify basic reachability of one IP: curl --resolve speed.example.com:443:104.16.1.1 https://speed.example.com/ or a TCP ping.
  3. If everything fails, change -tp to a port your network allows (443 is safest) or test from another network.
  4. Refresh ip.txt from a current Cloudflare ranges source so the pool contains live IPs.
Defensive patterns

Strategy: retry

Validate before calling

# pre-flight one representative IP before a long run
curl -sI --max-time 3 --resolve speed.example.com:443:104.16.1.1 \
  https://speed.example.com/ >/dev/null && echo ok || echo "egress to 443 blocked"

Try / catch

// per-IP: treat Do() failure as skip-and-move-on (as upstream does),
// optionally with one retry before scoring the IP as 0.
for attempt := 0; attempt < 2; attempt++ {
	if resp, err := hc.Do(req); err == nil {
		resp.Body.Close()
		break
	}
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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