XIU2/CloudflareSpeedTest
DevOps & Self-hostingTests Cloudflare and other CDN IP ranges for latency and download speed, ranking the fastest IPv4/IPv6 addresses for self-hosted routing.
What it does
Cloudflare hands every visitor an Anycast IP, and from mainland China those IPs often route badly: high latency, packet loss, low throughput. This tool (CFST) scans a list of IP ranges, measures TCP or HTTP latency, then download speed, and prints the fastest addresses. Results can be written to result.csv for use in hosts files or local DNS rules.
The default run does latency testing, latency-based sorting and filtering, download testing from the lowest-latency candidates upward, speed sorting, and then prints the top 10 IPs. The first row is the fastest IP by download speed among those with the lowest average latency.
It is aimed at users who want to pick usable Cloudflare CDN IPs behind a router, hosts file, or local DNS. It also works with other CDNs and any site that resolves to multiple IPs, but you have to supply your own download test URL for those.
Quick start
- Download a prebuilt binary from Releases (Windows and Linux/macOS archives are available) and extract it. On Windows,
cfst.execan be run directly. - On Linux/macOS, open a terminal in the extracted directory, make the binary executable, and run it:
chmod +x cfst
./cfst
- After the run finishes, the fastest 10 IPs are printed and the full result is written to
result.csvin the current directory. Open it with a text editor or spreadsheet; Excel may show garbled Chinese, which the README attributes to Excel.
Parameters can be combined, for example ./cfst -tl 200 -dn 20, which limits average latency to 200 ms and download-tests 20 IPs. Full parameter meanings are in the usage section.
To test a specific set of addresses instead of the bundled list:
./cfst -ip 1.1.1.1,2.2.2.2/24,2606:4700::/32
Requirements and constraints
- The bundled IP list and default test URL are Cloudflare-oriented. For other CDNs or arbitrary multi-IP sites, you must provide a download test URL with
-url; the address needs to be directly downloadable and larger than 200 MB. - The default latency mode is TCP (
-tpdefaults to 443). HTTPing mode (-httping) also reads the region code from HTTP response headers and works only with a suitable test URL. - Region filtering (
-cfcolo) only works in HTTPing mode. Cloudflare, AWS CloudFront and Fastly use IATA airport codes; CDN77 and Bunny use two-letter country codes; Gcore uses two-letter city codes. - Running behind a proxy or on a router with its own proxy can produce misleading results. The README explicitly asks users to turn off proxies before testing.
- HTTPing is effectively network scanning. On servers, high concurrency (
-n) can trigger provider or CDN rate limits; the README recommends lowering it. - UDP-based Cloudflare WARP IP selection is not supported.
- The tool cannot change routing by itself; you still need to apply the selected IPs through hosts files, a local DNS service, or router settings.
- Licensed under GPL-3.0.
Interpreting the output
During latency testing, the available count only means IPs that did not time out, not IPs that pass the latency/loss filters. The download-test queue is the number of IPs left after filtering; download testing is single-threaded. If -sl is set and fewer than -dn IPs meet the speed threshold, testing continues until the queue is exhausted. If the queue runs out with no qualifying IP, no result is printed unless -debug is enabled, which then outputs all results. The README recommends starting without filters to see typical latency and speed ranges.
HotRepo's take
On the 2026-11-01 daily Go list, the repository recorded 22 new stars and reached position 17 on that Go daily chart. That is a single-day observation, so it says nothing about sustained growth; the recorded star curve contains no samples, so no trend can be derived. The project’s relevance is structural: Chinese users still face poor route assignment on Cloudflare’s Anycast IPs, and a Go binary with no service dependency is easy to drop onto a router or old laptop. The GPL-3.0 license and the surrounding derivative projects (Android apps, OpenWrt packages, a Rust port) show a practical ecosystem rather than a one-off script.
Written by AI from the project's README, updated . The project's own docs are the source of truth.