From 59ccc0fd871c4bbd12066f2f6aacf835a839885d Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 8 Feb 2013 10:10:43 +0000 Subject: add nodes-to-json: parses retiolum/hosts folder into json --- retiolum/bin/find-supernodes | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 retiolum/bin/find-supernodes (limited to 'retiolum/bin/find-supernodes') diff --git a/retiolum/bin/find-supernodes b/retiolum/bin/find-supernodes new file mode 100755 index 00000000..2c316d0e --- /dev/null +++ b/retiolum/bin/find-supernodes @@ -0,0 +1,21 @@ +#! /bin/dash +set -eu +cd /etc/tinc/retiolum/hosts +for name in ` + grep '^[[:space:]]*Address[[:space:]]*=' * | + cut -d: -f1 | sort | uniq +`; do + if eval "`sed -n ' + s/[[:space:]]\+//g + s/^\(Address\|Port\)=\(.*\)/\1="\${\1+\$\1\n}\2"/p + ' $name`"; then + port=${Port-655} + for host in $Address; do + if nc -zw 2 $host $port 2>/dev/null; then + echo "$name [('$host', $port)]" + fi & + done + wait + fi & +done +wait -- cgit v1.2.3