Add plain HTTP transfer CI; update TODO

This commit is contained in:
Joakim Frostegård 2024-01-27 10:58:36 +01:00
parent 352194e0bd
commit d26578d0ba
2 changed files with 28 additions and 31 deletions

View file

@ -42,8 +42,7 @@ $SUDO echo "127.0.0.1 example.com" >> /etc/hosts
openssl ecparam -genkey -name prime256v1 -out key.pem
openssl req -new -sha256 -key key.pem -out csr.csr -subj "/C=GB/ST=Test/L=Test/O=Test/OU=Test/CN=example.com"
openssl req -x509 -sha256 -nodes -days 365 -key key.pem -in csr.csr -out cert.crt
openssl pkcs8 -in key.pem -topk8 -nocrypt -out key.pk8 # rustls
openssl pkcs12 -export -passout "pass:p" -out identity.pfx -inkey key.pem -in cert.crt
openssl pkcs8 -in key.pem -topk8 -nocrypt -out key.pk8
$SUDO cp cert.crt /usr/local/share/ca-certificates/snakeoil.crt
$SUDO update-ca-certificates
@ -52,11 +51,11 @@ $SUDO update-ca-certificates
cargo build --bin aquatic
# echo "log_level = 'debug'
#
# [network]
# address = '127.0.0.1:3000'" > http.toml
# ./target/debug/aquatic http -c http.toml > "$HOME/http.log" 2>&1 &
echo "log_level = 'debug'
[network]
address = '127.0.0.1:3004'" > http.toml
./target/debug/aquatic http -c http.toml > "$HOME/http.log" 2>&1 &
echo "log_level = 'debug'
@ -104,12 +103,13 @@ mkdir torrents
# Create torrents
# echo "http-test-ipv4" > seed/http-test-ipv4
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 "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/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/ws-tls-ipv4.torrent" -a "wss://example.com:3002" "seed/ws-tls-test-ipv4"
@ -165,7 +165,7 @@ cd ..
# Check for completion
# HTTP_IPv4="Ok"
HTTP_IPv4="Ok"
TLS_IPv4="Failed"
UDP_IPv4="Failed"
WS_TLS_IPv4="Failed"
@ -177,14 +177,14 @@ echo "Watching for finished files.."
while [ $i -lt 60 ]
do
# if test -f "leech/http-test-ipv4"; then
# if grep -q "http-test-ipv4" "leech/http-test-ipv4"; then
# if [ "$HTTP_IPv4" != "Ok" ]; then
# HTTP_IPv4="Ok"
# echo "HTTP_IPv4 is Ok"
# fi
# fi
# fi
if test -f "leech/http-test-ipv4"; then
if grep -q "http-test-ipv4" "leech/http-test-ipv4"; then
if [ "$HTTP_IPv4" != "Ok" ]; then
HTTP_IPv4="Ok"
echo "HTTP_IPv4 is Ok"
fi
fi
fi
if test -f "leech/tls-test-ipv4"; then
if grep -q "tls-test-ipv4" "leech/tls-test-ipv4"; then
if [ "$TLS_IPv4" != "Ok" ]; then
@ -218,7 +218,7 @@ do
fi
fi
if [ "$TLS_IPv4" = "Ok" ] && [ "$UDP_IPv4" = "Ok" ] && [ "$WS_TLS_IPv4" = "Ok" ] && [ "$WS_IPv4" = "Ok" ]; then
if [ "$HTTP_IPv4" = "Ok" ] &&[ "$TLS_IPv4" = "Ok" ] && [ "$UDP_IPv4" = "Ok" ] && [ "$WS_TLS_IPv4" = "Ok" ] && [ "$WS_IPv4" = "Ok" ]; then
break
fi
@ -229,15 +229,15 @@ done
echo "Waited for $i seconds"
# echo "::set-output name=http_ipv4::$HTTP_IPv4"
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=ws_tls_ipv4::$WS_TLS_IPv4"
echo "::set-output name=ws_ipv4::$WS_IPv4"
# echo ""
# echo "# --- HTTP log --- #"
# cat "http.log"
echo ""
echo "# --- HTTP log --- #"
cat "http.log"
sleep 1
@ -291,11 +291,12 @@ sleep 1
echo ""
echo "# --- Test results --- #"
echo "HTTP over TLS (IPv4): $TLS_IPv4"
echo "UDP (IPv4): $UDP_IPv4"
echo "WSS (IPv4): $WS_TLS_IPv4"
echo "WS (IPv4): $WS_IPv4"
echo "HTTP: $HTTP_IPv4"
echo "HTTP (TLS): $TLS_IPv4"
echo "UDP: $UDP_IPv4"
echo "WebTorrent (TLS): $WS_TLS_IPv4"
echo "WebTorrent: $WS_IPv4"
if [ "$TLS_IPv4" != "Ok" ] || [ "$UDP_IPv4" != "Ok" ] || [ "$WS_TLS_IPv4" != "Ok" ] || [ "$WS_IPv4" != "Ok" ]; then
if [ "$HTTP_IPv4" != "Ok" ] || [ "$TLS_IPv4" != "Ok" ] || [ "$UDP_IPv4" != "Ok" ] || [ "$WS_TLS_IPv4" != "Ok" ] || [ "$WS_IPv4" != "Ok" ]; then
exit 1
fi