tomeshnet / meshstream

Live video stream with a distributed file system over a physical mesh network
GNU General Public License v3.0
22 stars 4 forks source link

SSB Peering #12

Open darkdrgn2k opened 6 years ago

darkdrgn2k commented 6 years ago

Modified broadcast script to "advertise" all users created on the ssb-web client

to do:

#!/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
darkdrgn2k commented 6 years ago

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)