Last active
September 3, 2021 08:52
-
-
Save grahamc/df1bb806eb3552650d03eef7036a72ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env nix-shell | |
#!nix-shell -i bash -p bind.dnsutils -p traceroute -p curl | |
# impure: needs ping | |
#source: https://s3.amazonaws.com/aws-cloudfront-testing/CustomerTesting.html | |
function _e { | |
echo "> $@" | |
eval "$@" 2>&1 | sed -e "s/^/ /" | |
printf "Exit: %s\n\n\n" "$?" | |
} | |
function curl_test { | |
curl -w " | |
time_namelookup: %{time_namelookup} | |
time_connect: %{time_connect} | |
time_appconnect: %{time_appconnect} | |
time_pretransfer: %{time_pretransfer} | |
time_redirect: %{time_redirect} | |
time_starttransfer: %{time_starttransfer} | |
time_total: %{time_total} | |
" -v -o /dev/null "$@" | |
} | |
function ix { | |
url=$(cat | curl -F 'f:1=<-' ix.io 2> /dev/null) | |
echo "Pasted at: $url" | |
} | |
( | |
_e ping -c1 d3m36hgdyp4koz.cloudfront.net | |
_e ping -4 -c1 d3m36hgdyp4koz.cloudfront.net | |
_e ping -6 -c1 d3m36hgdyp4koz.cloudfront.net | |
_e dig -t A identity.cloudfront.net | |
_e dig -t A resolver-identity.cloudfront.net | |
_e traceroute -4 d3m36hgdyp4koz.cloudfront.net | |
_e traceroute -6 d3m36hgdyp4koz.cloudfront.net | |
_e curl_test -4 'https://d3m36hgdyp4koz.cloudfront.net/nar/0dnnfy935ihgmdrc0lmj5mir7bprsclpyh0gjxyxkcqsi3jy2l7g.nar.xz' | |
_e curl_test -6 'https://d3m36hgdyp4koz.cloudfront.net/nar/0dnnfy935ihgmdrc0lmj5mir7bprsclpyh0gjxyxkcqsi3jy2l7g.nar.xz' | |
_e curl -I -4 'https://cache.nixos.org/' | |
_e curl -I -4 'https://cache.nixos.org/' | |
_e curl -I -4 'https://cache.nixos.org/' | |
_e curl -I -6 'https://cache.nixos.org/' | |
_e curl -I -6 'https://cache.nixos.org/' | |
_e curl -I -6 'https://cache.nixos.org/' | |
) | tee /dev/stderr | ix |
Thanks Graham.
Now the scripts might need updating, at least the lines with cloudfront.net
most likely won't be useful anymore, though I don't really know what data is useful here.
There is a new version of this script that now lives over here: https://github.com/NixOS/nixos-org-configurations/blob/master/terraform/cache/diagnostic.sh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated the above script to reflect these changes, including EDIT1 -- Graham
Please, don't use
dig -4
. I think you meantdig -t A
(which is the default, so you may well simply drop the-4
).dig -4
will attempt to use IPv4 to contact the DNS resolver, which leads to a very strange hang in my case, as I only have an IPv6 server in my/etc/resolv.conf
–::1
.EDIT1: changed in my fork: https://gist.github.com/vcunat/cc34de33141006c5a2341e0b9683de8b
I suppose
ping
might be also doubled toping -4
andping -6
, but I don't know if that would be more useful for debugging the CDN.