Count how many instances that have federated with on Mastodon who use CloudFlare

(This post is just advertising how to use my new pet project)

Getting the list of peers ready

This depends on their instance api being accessible (and running Mastodon), but if it is, run this command replacing $YOURINSTANCE with your instance's FQDN (and install gron):

gron https://$YOURINSTANCE/api/v1/instance/peers | sed 's|.*"\(.*\)".*|\1|' - | sed 's/^/https\:\/\//; s/$/\//' - | tail -n +2 > peers.txt

Running Cloudfinder

Then we'll use my new tool, cloudfinder to detect which instances are using cloudflare in this list we've created. To do that, you will need to install stack, then git clone the repository and run this in the new directory:

stack install
cloudfinder -f peers.txt > results.txt

Then just analyze the results with, for example:

cat results.txt | grep " - CloudFlare" | wc -l

which would tell you how many instances have CloudFlare!