summaryrefslogtreecommitdiff
path: root/nodegen
blob: 813419837ed259bda91685d30c12da72404e79e1 (about) (plain)
1
2
3
4
5
6
7
8
9
#!/bin/sh

echo 'static struct node nodes[] = {'

curl -s https://nodes.tox.chat/json |
jq --tab '[.nodes[] | select(.last_ping > 0) | {".addr4": .ipv4, ".addr6": .ipv6, ".port": .port, ".idstr": .public_key}]' |
sed 's/"-"/NULL/; s/"\(\.[0-9a-z]\+\)":/\1 =/; 1d; $d'

echo '};'