mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
github transfer test workflow: test HTTP over TLS too, rename
This commit is contained in:
parent
95e8831daf
commit
60cafbad6a
4 changed files with 68 additions and 13 deletions
|
|
@ -1,8 +1,10 @@
|
||||||
name: 'test-transfer-udp-http'
|
name: 'test-transfer-http-udp'
|
||||||
description: 'test aquatic udp and http file transfer'
|
description: 'test aquatic http and udp file transfer'
|
||||||
outputs:
|
outputs:
|
||||||
http_ipv4:
|
http_ipv4:
|
||||||
description: 'HTTP IPv4 status'
|
description: 'HTTP IPv4 status'
|
||||||
|
http_tls_ipv4:
|
||||||
|
description: 'HTTP IPv4 over TLS status'
|
||||||
udp_ipv4:
|
udp_ipv4:
|
||||||
description: 'UDP IPv4 status'
|
description: 'UDP IPv4 status'
|
||||||
runs:
|
runs:
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Test that file transfers work with aquatic_http (with and without TLS)
|
||||||
|
# and aquatic_udp.
|
||||||
|
#
|
||||||
# IPv6 is unfortunately disabled by default in Docker
|
# IPv6 is unfortunately disabled by default in Docker
|
||||||
# (see sysctl net.ipv6.conf.lo.disable_ipv6)
|
# (see sysctl net.ipv6.conf.lo.disable_ipv6)
|
||||||
|
|
||||||
|
|
@ -13,11 +17,11 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$SUDO apt-get update
|
$SUDO apt-get update
|
||||||
$SUDO apt-get install -y cmake libssl-dev screen rtorrent mktorrent
|
$SUDO apt-get install -y cmake libssl-dev screen rtorrent mktorrent ssl-cert ca-certificates
|
||||||
|
|
||||||
rtorrent -h
|
rtorrent -h
|
||||||
|
|
||||||
# Build and start tracker
|
# Clone repository if necessary, go to repository directory
|
||||||
|
|
||||||
if [[ -z "${GITHUB_WORKSPACE}" ]]; then
|
if [[ -z "${GITHUB_WORKSPACE}" ]]; then
|
||||||
cd "$HOME"
|
cd "$HOME"
|
||||||
|
|
@ -29,17 +33,42 @@ else
|
||||||
cd "$GITHUB_WORKSPACE"
|
cd "$GITHUB_WORKSPACE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Setup bogus TLS certificate
|
||||||
|
|
||||||
|
$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
|
||||||
|
|
||||||
|
$SUDO cp cert.crt /usr/local/share/ca-certificates/snakeoil.crt
|
||||||
|
$SUDO update-ca-certificates
|
||||||
|
|
||||||
|
openssl pkcs12 -export -passout "pass:p" -out identity.pfx -inkey key.pem -in cert.crt
|
||||||
|
|
||||||
|
# Build and start tracker
|
||||||
|
|
||||||
cargo build --bin aquatic
|
cargo build --bin aquatic
|
||||||
|
|
||||||
echo "log_level = 'debug'
|
echo "log_level = 'debug'
|
||||||
|
|
||||||
[network]
|
[network]
|
||||||
address = '127.0.0.1:3000'" > http.toml
|
address = '127.0.0.1:3000'" > http.toml
|
||||||
./target/debug/aquatic http -c http.toml &
|
./target/debug/aquatic http -c http.toml > "$HOME/http.log" 2>&1 &
|
||||||
|
|
||||||
|
echo "log_level = 'debug'
|
||||||
|
|
||||||
|
[network]
|
||||||
|
address = '127.0.0.1:3001'
|
||||||
|
use_tls = true
|
||||||
|
tls_pkcs12_path = './identity.pfx'
|
||||||
|
tls_pkcs12_password = 'p'
|
||||||
|
" > tls.toml
|
||||||
|
./target/debug/aquatic http -c tls.toml > "$HOME/tls.log" 2>&1 &
|
||||||
|
|
||||||
echo "[network]
|
echo "[network]
|
||||||
address = '127.0.0.1:3000'" > udp.toml
|
address = '127.0.0.1:3000'" > udp.toml
|
||||||
screen -dmS aquatic-udp ./target/debug/aquatic udp -c udp.toml
|
./target/debug/aquatic udp -c udp.toml > "$HOME/udp.log" 2>&1 &
|
||||||
|
|
||||||
# Setup directories
|
# Setup directories
|
||||||
|
|
||||||
|
|
@ -52,9 +81,11 @@ mkdir torrents
|
||||||
# Create 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 "udp-test-ipv4" > seed/udp-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/udp-ipv4.torrent" -a "udp://127.0.0.1:3000" "seed/udp-test-ipv4"
|
||||||
|
|
||||||
cp -r torrents torrents-seed
|
cp -r torrents torrents-seed
|
||||||
|
|
@ -81,6 +112,7 @@ screen -dmS rtorrent-leech rtorrent
|
||||||
# Check for completion
|
# Check for completion
|
||||||
|
|
||||||
HTTP_IPv4="Failed"
|
HTTP_IPv4="Failed"
|
||||||
|
TLS_IPv4="Failed"
|
||||||
UDP_IPv4="Failed"
|
UDP_IPv4="Failed"
|
||||||
|
|
||||||
i="0"
|
i="0"
|
||||||
|
|
@ -94,13 +126,18 @@ do
|
||||||
HTTP_IPv4="Ok"
|
HTTP_IPv4="Ok"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if test -f "leech/tls-test-ipv4"; then
|
||||||
|
if grep -q "tls-test-ipv4" "leech/tls-test-ipv4"; then
|
||||||
|
TLS_IPv4="Ok"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
if test -f "leech/udp-test-ipv4"; then
|
if test -f "leech/udp-test-ipv4"; then
|
||||||
if grep -q "udp-test-ipv4" "leech/udp-test-ipv4"; then
|
if grep -q "udp-test-ipv4" "leech/udp-test-ipv4"; then
|
||||||
UDP_IPv4="Ok"
|
UDP_IPv4="Ok"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$HTTP_IPv4" = "Ok" ] && [ "$UDP_IPv4" = "Ok" ]; then
|
if [ "$HTTP_IPv4" = "Ok" ] && [ "$TLS_IPv4" = "Ok" ] && [ "$UDP_IPv4" = "Ok" ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -112,11 +149,27 @@ done
|
||||||
echo "Waited for $i seconds"
|
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=udp_ipv4::$UDP_IPv4"
|
||||||
|
|
||||||
echo "UDP IPv4: $UDP_IPv4"
|
echo ""
|
||||||
echo "HTTP IPv4: $HTTP_IPv4"
|
echo "# --- HTTP log --- #"
|
||||||
|
cat "http.log"
|
||||||
|
|
||||||
if [ "$HTTP_IPv4" != "Ok" ] || [ "$UDP_IPv4" != "Ok" ]; then
|
echo ""
|
||||||
|
echo "# --- HTTP over TLS log --- #"
|
||||||
|
cat "tls.log"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "# --- UDP log --- #"
|
||||||
|
cat "udp.log"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "# --- Test results --- #"
|
||||||
|
echo "HTTP (IPv4): $HTTP_IPv4"
|
||||||
|
echo "HTTP over TLS (IPv4): $TLS_IPv4"
|
||||||
|
echo "UDP (IPv4): $UDP_IPv4"
|
||||||
|
|
||||||
|
if [ "$HTTP_IPv4" != "Ok" ] || [ "$TLS_IPv4" != "Ok" ] || [ "$UDP_IPv4" != "Ok" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
name: "Test UDP and HTTP file transfer"
|
name: "Test HTTP and UDP file transfer"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
@ -9,10 +9,10 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
test-transfer-http:
|
test-transfer-http:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Test BitTorrent file transfer over UDP and HTTP
|
name: "Test BitTorrent file transfer over HTTP (with and without TLS) and UDP"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Test file transfers
|
- name: Test file transfers
|
||||||
uses: ./.github/actions/test-transfer-udp-http
|
uses: ./.github/actions/test-transfer-http-udp
|
||||||
id: test_transfer_udp_http
|
id: test_transfer_udp_http
|
||||||
Loading…
Add table
Add a link
Reference in a new issue