meshstream
meshstream copied to clipboard
SSB Peering
Modified broadcast script to "advertise" all users created on the ssb-web client
to do:
- maybe only ones that are online (not idle?)
- add
&& echo $idto advertise the pi, or maybe not?
#!/bin/bash
id=$(sbot whoami | grep id | awk -F "\"" '{print $4}' | sed 's/.ed25519//' | sed 's/@//')
while true; do
while read -r id; do
for int in $(ls -1Atu /sys/class/net ); do
ip=$(ip addr show $int | grep -v inet6 | grep -v '127.0.0.1' |grep inet | head -n 1 | awk '{print $2}' | awk -F "/" '{print $1}')
if ! [ -z "$ip" ]; then
echo -n "net:$ip:8008~shs:$id" | socat -T 1 - UDP4-DATAGRAM:255.255.255.255:8008,broadcast,so-bindtodevice=$int &
echo "net:$ip:8008~shs:$id"
fi
done
done <<< $(sudo cat /var/www/backend/keys/* | grep id | grep -v "#" | awk '{print $2}' | tr -d '"' | sed 's/.ed25519//' | sed 's/@//')
sleep 15
done
From a prototype perspective maybe drop the $ID stuff and run this as a separate service (more distinc uninstall line between ssb-web and ssb)