{"record":{"id":"5adfe591eaef4fae","repo":"jeessy2/ddns-go","slug":"v-5adfe5","errorCode":null,"errorMessage":"请求失败: %v","messagePattern":"请求失败: %v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"dns/tnethk.go","lineNumber":272,"sourceCode":"\n\t// 构造完整URL\n\tbaseURL := \"https://www.tnet.hk\"\n\tfullURL := baseURL + apiPath + \"?\" + queryString\n\n\t// 创建HTTP请求\n\treq, err := http.NewRequest(method, fullURL, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"创建请求失败: %v\", err)\n\t}\n\n\t// 设置请求头\n\treq.Header.Set(\"Accept\", \"application/json\")\n\n\t// 发送请求\n\tclient := t.httpClient\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"请求失败: %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\t// 读取响应\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"读取响应失败: %v\", err)\n\t}\n\n\t// 检查HTTP状态码\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"API请求失败，状态码: %d, 响应: %s\", resp.StatusCode, string(body))\n\t}\n\n\treturn body, nil\n}\n","sourceCodeStart":254,"sourceCodeEnd":289,"githubUrl":"https://github.com/jeessy2/ddns-go/blob/5874c2e6667c69357ab95079421131104bd3fcae/dns/tnethk.go#L254-L289","documentation":"dns/tnethk.go request() wraps httpClient.Do(req) failures with \"请求失败: %v\" (request failed). The HTTP round trip itself could not complete for create, modify, or getRecordList — DNS resolution, TCP connect, TLS, or transport-level failure to reach www.tnet.hk.","triggerScenarios":"Any Tnet.hk API call where client.Do returns an error: DNS lookup failure for www.tnet.hk, connection refused/timeout, TLS handshake failure, or the configured proxy being unreachable.","commonSituations":"No internet or DNS outage on the host; firewall blocking outbound 443 to www.tnet.hk; corporate proxy misconfigured; system clock skew breaking TLS; provider temporarily offline.","solutions":["Check basic connectivity: curl -v https://www.tnet.hk from the same host","Verify DNS resolution of www.tnet.hk (try a public resolver like 1.1.1.1)","Check proxy environment variables / firewall rules for outbound HTTPS","If TLS-related, confirm the system clock and CA certificates are current, then retry"],"exampleFix":"// before\nresp, err := client.Do(req)\nif err != nil {\n\treturn nil, fmt.Errorf(\"请求失败: %v\", err)\n}\n// after (caller: retry with backoff on transport errors)\nvar body []byte\nfor i := 0; i < 3; i++ {\n\tbody, err = provider.getRecordList(domain)\n\tif err == nil || !strings.Contains(err.Error(), \"请求失败\") {\n\t\tbreak\n\t}\n\ttime.Sleep(time.Duration(1<<i) * time.Second)\n}","handlingStrategy":"retry","validationCode":"// preflight reachability probe\nresp, err := http.Get(\"https://www.tnet.hk\")\nif err != nil {\n\treturn fmt.Errorf(\"tnet.hk unreachable: %w\", err)\n}\nresp.Body.Close()","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"请求失败\") {\n\tfor i := 0; i < 3; i++ {\n\t\ttime.Sleep(time.Duration(1<<i) * time.Second)\n\t\tif body, err = op(); err == nil {\n\t\t\tbreak\n\t\t}\n\t}\n}","preventionTips":["Ensure outbound HTTPS to www.tnet.hk is allowed by firewalls/proxies","Keep system DNS working; pin a fallback resolver for DDNS hosts","Keep the system clock synced to avoid TLS failures","Run retries with exponential backoff for transient outages"],"tags":["network","dns-resolution","timeout"],"backgroundTag":"connection-refused","analyzedSha":"5874c2e6667c69357ab95079421131104bd3fcae","analyzedAt":"2026-09-03T15:41:16.799Z","contentChangedAt":"2026-09-03T15:41:16.799Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}