2019-07-14 01:37:05 -04:00
|
|
|
#!/bin/sh
|
2019-12-15 13:30:54 -05:00
|
|
|
set -x
|
2019-07-14 01:37:05 -04:00
|
|
|
|
2019-12-16 11:52:17 -05:00
|
|
|
# first run without TLS
|
2019-12-15 18:44:56 -05:00
|
|
|
cargo clean
|
2019-12-16 11:52:17 -05:00
|
|
|
cargo build --release --no-default-features
|
|
|
|
|
|
|
|
export PATH="$(pwd)/target/release:$PATH"
|
2019-12-15 18:44:56 -05:00
|
|
|
|
2019-07-14 01:37:05 -04:00
|
|
|
# first make sure udp-test succeeds running against itself
|
2019-12-16 11:52:17 -05:00
|
|
|
udp-test || exit 1
|
2019-07-14 01:37:05 -04:00
|
|
|
|
2019-12-15 13:30:54 -05:00
|
|
|
# now run udp-test without spawning other processes
|
2019-12-16 11:52:17 -05:00
|
|
|
udp-test -is || exit 1
|
2019-12-15 13:30:54 -05:00
|
|
|
|
2019-07-14 01:37:05 -04:00
|
|
|
# now run proxyd pointing to udp-test
|
2019-12-16 11:52:17 -05:00
|
|
|
wireguard-proxy -th 127.0.0.1:5555 -ut 127.0.0.1:51822 &
|
2019-07-14 01:37:05 -04:00
|
|
|
proxyd_pid=$!
|
|
|
|
# wait for ports to be set up, this is fragile...
|
2019-12-16 11:52:17 -05:00
|
|
|
sleep 5
|
2019-07-14 01:37:05 -04:00
|
|
|
# proxy pointing to proxyd
|
2019-12-16 11:52:17 -05:00
|
|
|
wireguard-proxy -tt 127.0.0.1:5555 &
|
|
|
|
proxy_pid=$!
|
|
|
|
# wait for ports to be set up, this is fragile...
|
|
|
|
sleep 1
|
|
|
|
# and udp-test pointing to proxy, which then hops to proxyd, and finally back to udp-test
|
|
|
|
udp-test -uh 127.0.0.1:51822
|
|
|
|
udp_exit=$?
|
|
|
|
|
|
|
|
kill $proxyd_pid $proxy_pid
|
|
|
|
|
|
|
|
[ $udp_exit -ne 0 ] && exit $udp_exit
|
|
|
|
|
|
|
|
# now run udp-test essentially just like the script above, but all in rust
|
|
|
|
udp-test -s || exit 1
|
|
|
|
|
|
|
|
echo "non-tls tests passed!"
|
2019-12-16 02:21:16 -05:00
|
|
|
|
|
|
|
echo -e '\n\n\n\n\n\n\n' | openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout cert.key
|
|
|
|
|
2019-12-16 11:52:17 -05:00
|
|
|
# first run without TLS
|
|
|
|
cargo clean
|
|
|
|
cargo build --release
|
|
|
|
|
|
|
|
export PATH="$(pwd)/target/release:$PATH"
|
|
|
|
|
|
|
|
# first make sure udp-test succeeds running against itself
|
|
|
|
udp-test || exit 1
|
|
|
|
|
|
|
|
# now run udp-test without spawning other processes
|
|
|
|
udp-test -is || exit 1
|
2019-12-16 02:21:16 -05:00
|
|
|
|
2019-12-16 11:52:17 -05:00
|
|
|
# now run proxyd pointing to udp-test
|
|
|
|
wireguard-proxy -th 127.0.0.1:5555 -ut 127.0.0.1:51822 --tls-key cert.key --tls-cert cert.pem &
|
|
|
|
proxyd_pid=$!
|
|
|
|
# wait for ports to be set up, this is fragile...
|
|
|
|
sleep 5
|
|
|
|
# proxy pointing to proxyd
|
|
|
|
wireguard-proxy -tt 127.0.0.1:5555 --tls &
|
2019-07-14 01:37:05 -04:00
|
|
|
proxy_pid=$!
|
|
|
|
# wait for ports to be set up, this is fragile...
|
|
|
|
sleep 1
|
|
|
|
# and udp-test pointing to proxy, which then hops to proxyd, and finally back to udp-test
|
2019-12-16 11:52:17 -05:00
|
|
|
udp-test -uh 127.0.0.1:51822
|
2019-07-14 01:37:05 -04:00
|
|
|
udp_exit=$?
|
|
|
|
|
|
|
|
kill $proxyd_pid $proxy_pid
|
|
|
|
|
2019-12-16 02:21:16 -05:00
|
|
|
rm -f cert.pem cert.key
|
|
|
|
|
2019-12-15 18:44:56 -05:00
|
|
|
[ $udp_exit -ne 0 ] && exit $udp_exit
|
|
|
|
|
|
|
|
# now run udp-test essentially just like the script above, but all in rust
|
2019-12-16 11:52:17 -05:00
|
|
|
udp-test -s
|
|
|
|
|
|
|
|
exit $?
|