-
Notifications
You must be signed in to change notification settings - Fork 3
/
run_endpoint.sh
executable file
·78 lines (69 loc) · 2.8 KB
/
run_endpoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
# Set up the routing needed for the simulation.
/setup.sh
cd quicly
if [ ! -z "$TESTCASE" ]; then
case "$TESTCASE" in
"handshake"|"transfer"|"retry"|"goodput"|"resumption"|"multiconnect") ;;
"http3") exit 127 ;;
*) exit 127 ;;
esac
fi
### Client side ###
if [ "$ROLE" == "client" ]; then
# Wait for the simulator to start up.
/wait-for-it.sh sim:57832 -s -t 30
cd /downloads
case "$TESTCASE" in
"resumption") TEST_PARAMS="-s previous_sessions.bin" ;;
*) ;;
esac
echo "Starting quicly client ..."
if [ ! -z "$REQUESTS" ]; then
echo "Requests: " $REQUESTS
# Pull file names out of requests, generate file list for cli.
for REQ in $REQUESTS; do
FILE=`echo $REQ | cut -f4 -d'/'`
FILES=${FILES}" "${FILE}
CLI_LIST=${CLI_LIST}" -P /"${FILE}
done
if [ "$TESTCASE" == "resumption" ]; then
# Client needs to be run twice. First, with one request.
FILE=`echo $FILES | cut -f1 -d" "`
echo "/quicly/cli -P /$FILE server 443"
/quicly/cli -P "/"$FILE $TEST_PARAMS -a "hq-24" -x x25519 -x secp256r1 -e /logs/$TESTCASE.out server 443
# Second time, with rest of the requests.
CLI_LIST=`echo $CLI_LIST | cut -f3- -d" "`
echo "/quicly/cli $CLI_LIST server 443"
/quicly/cli $CLI_LIST $TEST_PARAMS -a "hq-24" -x x25519 -x secp256r1 -e /logs/$TESTCASE.out server 443
rm -f previous_sessions.bin
elif [ "$TESTCASE" == "multiconnect" ]; then
# Client needs to be run once per file.
for FILE in $FILES; do
echo "/quicly/cli /$FILE server 443"
/quicly/cli -P "/"$FILE $TEST_PARAMS -a "hq-24" -x x25519 -x secp256r1 -e /logs/$TESTCASE.out server 443
done
else
# Client is run once for all files.
echo "/quicly/cli $CLI_LIST server 443"
/quicly/cli $CLI_LIST $TEST_PARAMS -a "hq-24" -x x25519 -x secp256r1 -e /logs/$TESTCASE.out server 443
fi
# Cleanup.
for FILE in $FILES; do
mv $FILE.downloaded $FILE
done
fi
### Server side ###
elif [ "$ROLE" == "server" ]; then
echo "Starting server for test:" $TESTCASE
echo "Serving files:"
cd /www && ls -l
case "$TESTCASE" in
"retry") TEST_PARAMS="-R" ;;
*) ;;
esac
echo "Starting quicly server ..."
echo "SERVER_PARAMS:" $SERVER_PARAMS "TEST_PARAMS:" $TEST_PARAMS
echo "/quicly/cli $SERVER_PARAMS $TEST_PARAMS -k /quicly/server.key -c /quicly/server.crt -e /logs/$TESTCASE.out 0.0.0.0 443"
/quicly/cli $SERVER_PARAMS $TEST_PARAMS -k /quicly/server.key -c /quicly/server.crt -x x25519 -x secp256r1 -a "hq-24" -e /logs/$TESTCASE.out 0.0.0.0 443
fi