| 1 | #!/usr/bin/env nix-shell |
| 2 | #!nix-shell -i bash -p bind.dnsutils -p mtr -p curl -p netcat |
| 3 | # shellcheck shell=bash |
| 4 | # impure: needs ping |
| 5 | # |
| 6 | # Run this script if you are having issues with cache.nixos.org and paste the |
| 7 | # output URL in a new issue in the same repo. |
| 8 | # |
| 9 | |
| 10 | domain=${1:-cache-staging.nixos.org} |
| 11 | |
| 12 | run() { |
| 13 | echo "> $*" |
| 14 | "$@" |& sed -e "s/^/ /" |
| 15 | printf "Exit: %s\n\n\n" "$?" |
| 16 | } |
| 17 | |
| 18 | curl_w=" |
| 19 | time_namelookup: %{time_namelookup} |
| 20 | time_connect: %{time_connect} |
| 21 | time_appconnect: %{time_appconnect} |
| 22 | time_pretransfer: %{time_pretransfer} |
| 23 | time_redirect: %{time_redirect} |
| 24 | time_starttransfer: %{time_starttransfer} |
| 25 | time_total: %{time_total} |
| 26 | " |
| 27 | |
| 28 | curl_test() { |
| 29 | curl -w "$curl_w" -v -o /dev/null "$@" |
| 30 | } |
| 31 | |
| 32 | termbin() { |
| 33 | url=$(cat | nc termbin.com 9999) |
| 34 | echo "Pasted at: $url" |
| 35 | } |
| 36 | |
| 37 | ( |
| 38 | echo "domain=$domain" |
| 39 | run dig -t A "$domain" |
| 40 | run ping -c1 "$domain" |
| 41 | run ping -4 -c1 "$domain" |
| 42 | run ping -6 -c1 "$domain" |
| 43 | run mtr -c 20 -w -r "$domain" |
| 44 | run curl_test -4 "http://$domain/" |
| 45 | run curl_test -6 "http://$domain/" |
| 46 | run curl_test -4 "https://$domain/" |
| 47 | run curl_test -6 "https://$domain/" |
| 48 | run curl -I -4 "https://$domain/" |
| 49 | run curl -I -4 "https://$domain/" |
| 50 | run curl -I -4 "https://$domain/" |
| 51 | run curl -I -6 "https://$domain/" |
| 52 | run curl -I -6 "https://$domain/" |
| 53 | run curl -I -6 "https://$domain/" |
| 54 | ) | tee /dev/stderr | termbin |