Skip to content

Instantly share code, notes, and snippets.

@eevmanu
Last active March 3, 2026 20:17
Show Gist options
  • Select an option

  • Save eevmanu/01d6f31e9635bc9d4fd840f5ecb0e837 to your computer and use it in GitHub Desktop.

Select an option

Save eevmanu/01d6f31e9635bc9d4fd840f5ecb0e837 to your computer and use it in GitHub Desktop.
detect available iperf3 servers in miami , new york and los angeles to have a more precise test of upload and download bandwidth
#!/usr/bin/env bash
iperf3_us_cities() {
local url='https://export.iperf3serverlist.net/listed_iperf3_servers.json'
local sites='los angeles|miami|new york city'
printf ' last-modified: '
curl -sI "$url" | grep -i '^last-modified:' | cut -d' ' -f2- | tr -d '\r'
printf '\n'
local result
result=$(curl -s "$url" | jq -r --arg s "$sites" '
[ .[] | select(.SITE | ascii_downcase | test("^(" + $s + ")$")) ] |
if length == 0 then
"WARN: 0 matches for [\($s)] -- schema may have changed",
" try: curl -s URL | jq \"[.[].SITE] | unique | sort\""
else .[] |
(.["IP/HOST"] // null) as $host |
if $host == null then
"# SKIP: no IP/HOST for \(.SITE // "?") (\(.PROVIDER // "?"))"
else
(.PORT // "5201") as $fp |
($fp | split("-")[0]) as $p |
(.OPTIONS // "" | split(",") | map(select(length>0)) | join(" ")) as $o |
"iperf3 -c \($host) -p \($p)" +
(if ($o | length) > 0 then " \($o)" else "" end) +
" # \(.SITE) -- \(.PROVIDER // "?")" +
(if ($fp | contains("-")) then " [range: \($fp)]" else "" end)
end
end
') || { echo "FAIL: curl or jq error -- inspect $url manually"; return 1; }
if [ -z "$result" ]; then
echo "FAIL: empty output -- check connectivity or JSON structure"
return 1
fi
echo "$result"
}
iperf3_us_cities
@eevmanu
Copy link
Author

eevmanu commented Mar 3, 2026

output example

  last-modified: Tue, 03 Mar 2026 20:00:01 GMT

iperf3 -c la.speedtest.clouvider.net -p 5200 -R -6 -u  # Los Angeles -- Clouvider  [range: 5200-5209]
iperf3 -c nyc.speedtest.clouvider.net -p 5201 -R -6 -u  # New York City -- Clouvider  [range: 5201-5209]
iperf3 -c 185.152.67.2 -p 5201 -R -u  # Los Angeles -- DATAPACKET
iperf3 -c 195.181.162.195 -p 5201 -R -u  # Miami -- DATAPACKET
iperf3 -c 23.249.54.234 -p 30000 -R  # Miami -- FortiSASE
iperf3 -c speedtest.lax12.us.leaseweb.net -p 5201 -R -6  # Los Angeles -- LeaseWeb  [range: 5201-5210]
iperf3 -c speedtest.mia11.us.leaseweb.net -p 5201 -R -6  # Miami -- LeaseWeb  [range: 5201-5210]
iperf3 -c speedtest.nyc1.us.leaseweb.net -p 5201 -R -6 -u  # New York City -- LeaseWeb  [range: 5201-5210]

@eevmanu
Copy link
Author

eevmanu commented Mar 3, 2026

there are other more reliable tools to measure latency like ping , mtr and irtt

@eevmanu
Copy link
Author

eevmanu commented Mar 3, 2026

a new tool i found recently is

https://radar.cloudflare.com/speedtest

Network Quality Test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment