summaryrefslogtreecommitdiff
path: root/nodegen
diff options
context:
space:
mode:
authorpranomostro <pranomestro@gmail.com>2016-11-02 09:56:37 +0100
committerz3bra <contactatz3bradotorg>2016-11-08 16:47:51 +0100
commit1450809b32bbf4c15bd084c6b3b003698fb7e107 (patch)
tree5ea7c2c7dc93df236cbb66d22983bf4982f6566f /nodegen
parenta1d2b63e6af32685f5828c302a0d3edeeb48090f (diff)
Add generating nodes from the available nodes.tox.chat API.
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 '};'