WIP bash VoIP clients

This commit is contained in:
Quentin 2019-10-22 17:42:20 +02:00
parent 3b4a2730a3
commit d42f458e84
13 changed files with 123 additions and 8 deletions

View file

@ -63,5 +63,5 @@ COPY --from=builder /home/donar-build/out/udpecho /usr/local/bin
COPY --from=builder /home/donar-build/out/torecho /usr/local/bin
COPY --from=builder /home/donar-build/tor2/src/app/tor /usr/local/bin/tor2
COPY --from=builder /home/donar-build/tor3/src/app/tor /usr/local/bin/tor3
COPY ./scripts/* /usr/local/bin/
COPY ./scripts/container/* /usr/local/bin/
COPY ./torrc_* /etc/

View file

@ -10,7 +10,7 @@ ggplot(data=link_info, aes(x=timestamp, y=link, color=speed)) +
theme_classic()
xx <- read.csv("../../donar-res/tmp_light/ae.csv")
xx <- read.csv("../../donar-res/tmp_light/v2.csv")
xx2 <- sqldf("select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way from xx group by packet_id,way")
ggplot(data=xx2, aes(x=packet_id, y=lat, color=way)) +
geom_line() +
@ -68,7 +68,7 @@ ggplot(data=xx3, aes(x=lat, group=flag, color=flag)) +
coord_cartesian(xlim=c(0,1200)) +
theme_classic()
xy <- read.csv("../../donar-res/tmp_light/aa.csv")
xy <- read.csv("../../donar-res/tmp_light/light.csv")
xz <- sqldf("select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way,conf,run from xy where packet_id > 50 and packet_id < 7400 group by packet_id,way,conf,run")
xz$conf <- factor(xz$conf)
ggplot(data=xz, aes(x=lat, group=conf, color=conf)) +
@ -83,8 +83,8 @@ ggplot(data=xz, aes(y=lat, x=conf)) +
geom_boxplot(width=0.1, outlier.shape=NA) +
theme_classic()
xa <- sqldf("select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way,conf,run from xy where flag=1 and packet_id > 50 and packet_id < 7400 group by packet_id,way,conf,run")
ggplot(data=sqldf("select * from xa where run='out/bhTF0rd7MOI5SOPs-6'"), aes(x=packet_id, y=lat, color=way)) +
xa <- sqldf("select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way,conf,run from xy group by packet_id,way,conf,run")
ggplot(data=sqldf("select * from xa where run='L6woUXrfE3XkJLyt-0'"), aes(x=packet_id, y=lat, color=way)) +
geom_line() +
geom_hline(yintercept=400) +
geom_hline(yintercept=200) +
@ -92,10 +92,10 @@ ggplot(data=sqldf("select * from xa where run='out/bhTF0rd7MOI5SOPs-6'"), aes(x=
#geom_point(aes(shape=conf)) +
theme_classic()
xb <- read.csv("../../donar-res/tmp_light/ae.csv")
xb <- read.csv("../../donar-res/tmp_light/v1.csv")
xb$flag <- factor(xb$flag)
xb$link_id <- factor(xb$link_id)
xc <- sqldf("select *, 1.0 * latency / 1000.0 as lat from xb where vanilla = 1 and link_id = 0")
xc <- sqldf("select *, 1.0 * latency / 1000.0 as lat from xb where vanilla = 1 and link_id = 5")
ggplot(data=xc, aes(x=packet_id, y=lat, color=link_id:way)) +
coord_cartesian(ylim=c(100,600)) +
geom_line() +
@ -137,7 +137,7 @@ ggplot(data=xd, aes(x=packet_id, y=lat, color=link_id)) +
geom_line() +
theme_classic()
ggplot(data=sqldf("select * from xb where vanilla = 1 and way= 'server'"), aes(x=packet_id, y=link_id, color=flag)) +
ggplot(data=sqldf("select * from xb where vanilla = 1 and way= 'client'"), aes(x=packet_id, y=link_id, color=flag)) +
geom_point() +
theme_classic()

58
scripts/container/start_client Executable file
View file

@ -0,0 +1,58 @@
#!/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
echo "[+] Please enter links and finish with an empty line"
while read -r $line; do
[ -z "$line" ] && break
echo $line >> onion_services.pub
done
donar \
-a lightning \
-c \
-o onion_services.pub \
-l $NLINKS \
-p $SCHED \
-b \
-e $LPORT \
-r $RPORT \
> $LOGS/client-donar-stdout.log 2> $LOGS/client-donar-stderr.log &
echo "[+] Started Donar. Local port is $LPORT, remote port is $RPORT."
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/client-donar-stdout.log | wc -l)
echo -ne "Connecting: $connections/$NLINKS%\033[0K\r"
done
echo "Ready"
echo "[+] Let's rocks!"

57
scripts/container/start_server Executable file
View file

@ -0,0 +1,57 @@
#!/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!"