tnodegen - ratox - FIFO based tox client
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
tnodegen (373B)
---
1 #!/bin/sh
2
3 echo 'static struct node nodes[] = {'
4
5 curl -s https://nodes.tox.chat/json |
6 jq --tab '[.nodes[] |
7 select(.last_ping > 0) |
8 select(.tcp_ports | length > 0) |
9 {".addr4": .ipv4, ".addr6": .ipv6, ".udp_port": .port, ".tcp_port": .tcp_ports[0], ".idstr": .public_key}]' |
10 sed 's/"-"/NULL/; s/"NONE"/NULL/; s/"\(\.[0-9a-z_][0-9a-z_]*\)":/\1 =/; 1d; $d'
11
12 echo '};'