summaryrefslogtreecommitdiff
path: root/nodegen
diff options
context:
space:
mode:
Diffstat (limited to 'nodegen')
-rwxr-xr-xnodegen9
1 files changed, 9 insertions, 0 deletions
diff --git a/nodegen b/nodegen
new file mode 100755
index 0000000..aac6920
--- /dev/null
+++ b/nodegen
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+echo 'static struct node nodes[] = {'
+
+curl https://nodes.tox.chat/json |
+jq --tab '[.nodes[] | {".addr4": .ipv4, ".addr6": .ipv6, ".port": .port, ".idstr": .public_key}]' |
+sed 's/"-"/NULL/; s/"\(\.[0-9a-z]\+\)":/\1 =/; 1d; $d'
+
+echo '};'