tor_multipath_voip/scripts/container/start_server

57 lines
1.5 KiB
Bash
Executable file

#!/bin/bash
LPORT="${NLINKS:-9000}"
RPORT="${NLINKS:-9000}"
NLINKS="${NLINKS:-16}"
SCHED="${SCHED:-tick_tock=0}"
LOGS="/tmp/donar_log"
mkdir -p $LOGS
echo "[+] Log folder is $LOGS"
tor2 -f /etc/torrc_simple > $LOGS/tor.stdout 2> $LOGS/tor.stderr &
echo "[+] Started Tor"
sleep 2
donar \
-a lightning \
-s \
-l $NLINKS \
-p $SCHED \
-b \
-e $LPORT \
-r $RPORT \
> $LOGS/server-donar-stdout.log 2> $LOGS/server-donar-stderr.log &
echo "[+] Started Donar. Local port is $LPORT, remote port is $RPORT."
until [ -f onion_services.pub ]; do sleep 1; done
echo "--- Please forward the following addresses: ---"
cat onion_services.pub
echo ""
echo "------"
gst-launch-1.0 \
autoaudiosrc ! \
webrtcdsp ! \
queue ! \
audioresample ! \
opusenc audio-type=voice inband-fec=FALSE frame-size=40 bitrate=32000 dtx=TRUE ! \
rtpopuspay ! \
udpsink host=127.13.3.7 port=9000 async=FALSE \
udpsrc port=9000 caps="application/x-rtp" ! \
rtpjitterbuffer do-lost=TRUE do-retransmission=FALSE latency=10 ! \
rtpopusdepay ! \
opusdec plc=TRUE use-inband-fec=FALSE ! \
audioresample ! \
webrtcechoprobe ! \
autoaudiosink > $LOGS/gstreamer.stdout 2> $LOGS/gstreamer.stderr &
echo "[+] Started GStreamer"
echo "[+] Waiting for connections"
connections=0
while [ $connections -ne $NLINKS ]; do
sleep 1
connections=$(grep 'Succeeded,' $LOGS/server-donar-stdout.log | wc -l)
echo -ne "Connecting: $connections/$NLINKS%\033[0K\r"
done
echo "Ready"
echo "[+] Let's rocks!"