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

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