peers.sh 812 B

123456789101112131415161718
  1. #!/bin/sh
  2. home_instance="https://queer.hacktivis.me"
  3. instances_peers=$(curl -sSL "${home_instance}/api/v1/instance/peers" | jq -r .[])
  4. for instance in $instances_peers
  5. do
  6. echo -n "
  7. ${instance}:"
  8. host -t A "${instance}" | grep 'has address' >/dev/null 2>&1 && echo -n ' A'
  9. host -t AAAA "${instance}" | grep 'has IPv6' >/dev/null 2>&1 && echo -n ' AAAA'
  10. # [ -z "$(dig +short ${instance} A 2>/dev/null)" ] || echo -n ' A'
  11. # [ -z "$(dig +short ${instance} AAAA 2>/dev/null)" ] || echo -n ' AAAA'
  12. ping -4 -c 3 "${instance}" >/dev/null 2>&1 && echo -n ' ICMPv4'
  13. ping -6 -c 3 "${instance}" >/dev/null 2>&1 && echo -n ' ICMPv6'
  14. curl -4 -sSL "https://${instance}/" >/dev/null 2>&1 && echo -n ' HTTPSv4'
  15. curl -6 -sSL "https://${instance}/" >/dev/null 2>&1 && echo -n ' HTTPSv6'
  16. done