From 72c66e6e1a78fbe059398e09d92b13b994008445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Tue, 19 Jul 2022 17:12:39 +0200 Subject: [PATCH] GitHub CI: add transfer test for non-TLS WebTorrent --- .github/actions/test-transfer/entrypoint.sh | 102 ++++++++++++++------ 1 file changed, 75 insertions(+), 27 deletions(-) diff --git a/.github/actions/test-transfer/entrypoint.sh b/.github/actions/test-transfer/entrypoint.sh index ea27737..2fab330 100755 --- a/.github/actions/test-transfer/entrypoint.sh +++ b/.github/actions/test-transfer/entrypoint.sh @@ -85,8 +85,16 @@ address = '127.0.0.1:3002' enable_tls = true tls_certificate_path = './cert.crt' tls_private_key_path = './key.pk8' +" > ws-tls.toml +./target/debug/aquatic ws -c ws-tls.toml > "$HOME/ws-tls.log" 2>&1 & + +echo "log_level = 'trace' + +[network] +address = '127.0.0.1:3003' +enable_http_health_checks = true " > ws.toml -./target/debug/aquatic ws -c ws.toml > "$HOME/wss.log" 2>&1 & +./target/debug/aquatic ws -c ws.toml > "$HOME/ws.log" 2>&1 & # Setup directories @@ -101,21 +109,30 @@ mkdir torrents # echo "http-test-ipv4" > seed/http-test-ipv4 echo "tls-test-ipv4" > seed/tls-test-ipv4 echo "udp-test-ipv4" > seed/udp-test-ipv4 -echo "wss-test-ipv4" > seed/wss-test-ipv4 +echo "ws-tls-test-ipv4" > seed/ws-tls-test-ipv4 +echo "ws-test-ipv4" > seed/ws-test-ipv4 # mktorrent -p -o "torrents/http-ipv4.torrent" -a "http://127.0.0.1:3000/announce" "seed/http-test-ipv4" mktorrent -p -o "torrents/tls-ipv4.torrent" -a "https://example.com:3001/announce" "seed/tls-test-ipv4" mktorrent -p -o "torrents/udp-ipv4.torrent" -a "udp://127.0.0.1:3000" "seed/udp-test-ipv4" -mktorrent -p -o "torrents/wss-ipv4.torrent" -a "wss://example.com:3002" "seed/wss-test-ipv4" +mktorrent -p -o "torrents/ws-tls-ipv4.torrent" -a "wss://example.com:3002" "seed/ws-tls-test-ipv4" +mktorrent -p -o "torrents/ws-ipv4.torrent" -a "ws://example.com:3003" "seed/ws-test-ipv4" cp -r torrents torrents-seed cp -r torrents torrents-leech -# Setup wss seeding client +# Setup ws-tls seeding client -echo "Starting seeding wss client" +echo "Starting seeding ws-tls (wss) client" cd seed -GOPPROF=http GODEBUG=x509ignoreCN=0 $HOME/gotorrent download --dht=false --tcppeers=false --utppeers=false --pex=false --stats --seed ../torrents/wss-ipv4.torrent > "$HOME/wss-seed.log" 2>&1 & +GOPPROF=http GODEBUG=x509ignoreCN=0 $HOME/gotorrent download --dht=false --tcppeers=false --utppeers=false --pex=false --stats --seed ../torrents/ws-tls-ipv4.torrent > "$HOME/ws-tls-seed.log" 2>&1 & +cd .. + +# Setup ws seeding client + +echo "Starting seeding ws client" +cd seed +GOPPROF=http GODEBUG=x509ignoreCN=0 $HOME/gotorrent download --dht=false --tcppeers=false --utppeers=false --pex=false --stats --seed ../torrents/ws-ipv4.torrent > "$HOME/ws-seed.log" 2>&1 & cd .. # Start seeding rtorrent client @@ -139,9 +156,14 @@ schedule2 = watch_directory,5,5,load.start=$HOME/torrents-leech/*.torrent" > ~/. echo "Starting leeching client.." screen -dmS rtorrent-leech rtorrent -echo "Starting leeching wss client" +echo "Starting leeching ws-tls (wss) client" cd leech -GOPPROF=http GODEBUG=x509ignoreCN=0 $HOME/gotorrent download --dht=false --tcppeers=false --utppeers=false --pex=false --stats --addr ":43000" ../torrents/wss-ipv4.torrent > "$HOME/wss-leech.log" 2>&1 & +GOPPROF=http GODEBUG=x509ignoreCN=0 $HOME/gotorrent download --dht=false --tcppeers=false --utppeers=false --pex=false --stats --addr ":43000" ../torrents/ws-tls-ipv4.torrent > "$HOME/ws-tls-leech.log" 2>&1 & +cd .. + +echo "Starting leeching ws client" +cd leech +GOPPROF=http GODEBUG=x509ignoreCN=0 $HOME/gotorrent download --dht=false --tcppeers=false --utppeers=false --pex=false --stats --addr ":43001" ../torrents/ws-ipv4.torrent > "$HOME/ws-leech.log" 2>&1 & cd .. # Check for completion @@ -149,7 +171,8 @@ cd .. # HTTP_IPv4="Ok" TLS_IPv4="Failed" UDP_IPv4="Failed" -WSS_IPv4="Failed" +WS_TLS_IPv4="Failed" +WS_IPv4="Failed" i="0" @@ -181,17 +204,24 @@ do fi fi fi - if test -f "leech/wss-test-ipv4"; then - if grep -q "wss-test-ipv4" "leech/wss-test-ipv4"; then - if [ "$WSS_IPv4" != "Ok" ]; then - WSS_IPv4="Ok" - echo "WSS_IPv4 is Ok" + if test -f "leech/ws-tls-test-ipv4"; then + if grep -q "ws-tls-test-ipv4" "leech/ws-tls-test-ipv4"; then + if [ "$WS_TLS_IPv4" != "Ok" ]; then + WS_TLS_IPv4="Ok" + echo "WS_TLS_IPv4 is Ok" + fi + fi + fi + if test -f "leech/ws-test-ipv4"; then + if grep -q "ws-test-ipv4" "leech/ws-test-ipv4"; then + if [ "$WS_IPv4" != "Ok" ]; then + WS_IPv4="Ok" + echo "WS_IPv4 is Ok" fi fi fi - # if [ "$HTTP_IPv4" = "Ok" ] && [ "$TLS_IPv4" = "Ok" ] && [ "$UDP_IPv4" = "Ok" ] && [ "$WSS_IPv4" = "Ok" ]; then - if [ "$TLS_IPv4" = "Ok" ] && [ "$UDP_IPv4" = "Ok" ] && [ "$WSS_IPv4" = "Ok" ]; then + if [ "$TLS_IPv4" = "Ok" ] && [ "$UDP_IPv4" = "Ok" ] && [ "$WS_TLS_IPv4" = "Ok" ] && [ "$WS_IPv4" = "Ok" ]; then break fi @@ -205,7 +235,8 @@ echo "Waited for $i seconds" # echo "::set-output name=http_ipv4::$HTTP_IPv4" echo "::set-output name=http_tls_ipv4::$TLS_IPv4" echo "::set-output name=udp_ipv4::$UDP_IPv4" -echo "::set-output name=wss_ipv4::$WSS_IPv4" +echo "::set-output name=ws_tls_ipv4::$WS_TLS_IPv4" +echo "::set-output name=ws_ipv4::$WS_IPv4" # echo "" # echo "# --- HTTP log --- #" @@ -226,31 +257,48 @@ cat "udp.log" sleep 1 echo "" -echo "# --- WSS tracker log --- #" -cat "wss.log" +echo "# --- WS over TLS tracker log --- #" +cat "ws-tls.log" sleep 1 echo "" -echo "# --- WSS seed log --- #" -cat "wss-seed.log" +echo "# --- WS tracker log --- #" +cat "ws.log" sleep 1 echo "" -echo "# --- WSS leech log --- #" -cat "wss-leech.log" +echo "# --- WS over TLS seed log --- #" +cat "ws-tls-seed.log" + +sleep 1 + +echo "" +echo "# --- WS over TLS leech log --- #" +cat "ws-tls-leech.log" + +sleep 1 + +echo "" +echo "# --- WS seed log --- #" +cat "ws-seed.log" + +sleep 1 + +echo "" +echo "# --- WS leech log --- #" +cat "ws-leech.log" sleep 1 echo "" echo "# --- Test results --- #" -# echo "HTTP (IPv4): $HTTP_IPv4" echo "HTTP over TLS (IPv4): $TLS_IPv4" echo "UDP (IPv4): $UDP_IPv4" -echo "WSS (IPv4): $WSS_IPv4" +echo "WSS (IPv4): $WS_TLS_IPv4" +echo "WS (IPv4): $WS_IPv4" -# if [ "$HTTP_IPv4" != "Ok" ] || [ "$TLS_IPv4" != "Ok" ] || [ "$UDP_IPv4" != "Ok" ] || [ "$WSS_IPv4" != "Ok" ]; then -if [ "$TLS_IPv4" != "Ok" ] || [ "$UDP_IPv4" != "Ok" ] || [ "$WSS_IPv4" != "Ok" ]; then +if [ "$TLS_IPv4" != "Ok" ] || [ "$UDP_IPv4" != "Ok" ] || [ "$WS_TLS_IPv4" != "Ok" ] || [ "$WS_IPv4" != "Ok" ]; then exit 1 fi