{"record":{"id":"611d41ee2f0dad78","repo":"XIU2/CloudflareSpeedTest","slug":"cfst-ip-0","errorCode":null,"errorMessage":"CFST 测速结果 IP 数量为 0，跳过下面步骤...","messagePattern":"CFST 测速结果 IP 数量为 0，跳过下面步骤\\.\\.\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"script/cfst_ddns.sh","lineNumber":39,"sourceCode":"\t[[ -z \"${KEY}\" ]] && echo -e \"[错误] 缺少配置项 [KEY] !\" && exit 1\n\tEMAIL=$(echo \"${CONFIG}\"|grep 'EMAIL='|awk -F '=' '{print $NF}')\n\t[[ -z \"${EMAIL}\" ]] && echo -e \"[信息] 缺少配置项 [EMAIL]，由 [API 密钥] 方式转为 [API 令牌] 方式!\"\n\tTYPE=$(echo \"${CONFIG}\"|grep 'TYPE='|awk -F '=' '{print $NF}')\n\t[[ -z \"${TYPE}\" ]] && echo -e \"[错误] 缺少配置项 [TYPE] !\" && exit 1\n\tNAME=$(echo \"${CONFIG}\"|grep 'NAME='|awk -F '=' '{print $NF}')\n\t[[ -z \"${NAME}\" ]] && echo -e \"[错误] 缺少配置项 [NAME] !\" && exit 1\n\tTTL=$(echo \"${CONFIG}\"|grep 'TTL='|awk -F '=' '{print $NF}')\n\t[[ -z \"${TTL}\" ]] && echo -e \"[错误] 缺少配置项 [TTL] !\" && exit 1\n\tPROXIED=$(echo \"${CONFIG}\"|grep 'PROXIED='|awk -F '=' '{print $NF}')\n\t[[ -z \"${PROXIED}\" ]] && echo -e \"[错误] 缺少配置项 [PROXIED] !\" && exit 1\n}\n\n_UPDATE() {\n\t# 这里可以自己添加、修改 CFST 的运行参数\n\t./cfst -o \"result_ddns.txt\"\n\n\t# 判断结果文件是否存在，如果不存在说明结果为 0\n\t[[ ! -e \"result_ddns.txt\" ]] && echo \"CFST 测速结果 IP 数量为 0，跳过下面步骤...\" && exit 0\n\n\tCONTENT=$(sed -n \"2,1p\" result_ddns.txt | awk -F, '{print $1}')\n\tif [[ -z \"${CONTENT}\" ]]; then\n\t\techo \"CFST 测速结果 IP 数量为 0，跳过下面步骤...\"\n\t\texit 0\n\tfi\n\t# 如果 EMAIL 变量是空的，那么就代表要使用 API 令牌方式\n\tif [[ -n \"${EMAIL}\" ]]; then\n\t\t# API 密钥方式（全局权限）\n\t\tcurl -X PUT \"https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/dns_records/${DNS_RECORDS_ID}\" \\\n\t\t\t-H \"X-Auth-Email: ${EMAIL}\" \\\n\t\t\t-H \"X-Auth-Key: ${KEY}\" \\\n\t\t\t-H \"Content-Type: application/json\" \\\n\t\t\t--data \"{\\\"type\\\":\\\"${TYPE}\\\",\\\"name\\\":\\\"${NAME}\\\",\\\"content\\\":\\\"${CONTENT}\\\",\\\"ttl\\\":${TTL},\\\"proxied\\\":${PROXIED}}\"\n\telse\n\t\t# API 令牌方式（自定义权限）\n\t\tcurl -X PUT \"https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/dns_records/${DNS_RECORDS_ID}\" \\\n\t\t\t-H \"Authorization: Bearer ${KEY}\" \\","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/XIU2/CloudflareSpeedTest/blob/1da0c025d7b6f9bf0b2b0cf47a547f65430deab2/script/cfst_ddns.sh#L21-L57","documentation":"In _UPDATE() (script/cfst_ddns.sh:34-45), after ./cfst -o result_ddns.txt runs inside ${FOLDER} (cd happens at line 64), the script checks [[ ! -e result_ddns.txt ]] at line 39. CFST only writes its output file when at least one IP passes all filters, so a missing file is equated with '0 qualifying IPs'; the script prints this message and exits 0 — a deliberate graceful skip that leaves the Cloudflare record unchanged (stale IP stays).","triggerScenarios":"cfst found no IP meeting the latency/download filters (-t/-dt/-sl/-tp); all candidate IPs failed the TCP latency stage; the cfst binary or ip.txt is missing/not executable in FOLDER so ./cfst failed and produced no file; outbound testing ports (443/80) are blocked.","commonSituations":"Overly strict -sl lower bound on download speed; an aged ip.txt whose IPs no longer answer; a broken FOLDER path after moving the installation (the cd at line 64 lands somewhere without cfst); ISP/firewall blocking Cloudflare ranges so every test times out.","solutions":["cd into ${FOLDER} and run ./cfst -o result_ddns.txt manually to see the tester's real output and exit status","Verify the cfst binary is executable and ip.txt exists in that folder","Relax the CFST arguments added at line 36 (raise -t, lower -sl) or refresh ip.txt","Check outbound connectivity to port 443 on Cloudflare IPs; for cron, confirm FOLDER is valid from cron's working directory","For retry-until-found behavior, the comment at line 37 notes replacing this exit 0 with _UPDATE"],"exampleFix":"# script/cfst_ddns.sh line 36 (before)\n./cfst -o \"result_ddns.txt\"\n# (after) fail loudly when the tester itself is broken\n./cfst -o \"result_ddns.txt\" || { echo \"cfst run failed (exit $?)\"; exit 1; }","handlingStrategy":"retry","validationCode":"cd \"$(grep '^FOLDER=' cfst_ddns.conf | cut -d= -f2-)\" || exit 1\n[ -x ./cfst ] && [ -f ip.txt ] || { echo 'cfst binary or ip.txt missing' >&2; exit 1; }","typeGuard":null,"tryCatchPattern":"if ! ./cfst -o result_ddns.txt; then echo \"cfst exited $?: check filters/network\" >&2; exit 1; fi","preventionTips":["Run ./cfst manually once after any filter change to confirm non-empty output before automating","Keep -t/-sl conservative; tighten gradually while watching result_ddns.txt","Distinguish tester failure (binary/network) from empty results — check cfst's exit code, not just the file's existence","Leave the DNS record untouched on empty results (as the script does) so clients keep a stale-but-working IP"],"tags":["shell","bash","cloudflare","ddns","speedtest","empty-result"],"backgroundTag":null,"analyzedSha":"1da0c025d7b6f9bf0b2b0cf47a547f65430deab2","analyzedAt":"2026-08-15T22:22:10.737Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}