-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun_endpoint.sh
110 lines (100 loc) · 2.92 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/env bash
# Extra debugging ?
set -x
set -o nounset
VERSION=1
HQ_CLI=/proxygen/_build/proxygen/bin/hq
PORT=443
LOGLEVEL=2
# Set up the routing needed for the simulation
/setup.sh
# Unless noted otherwise, test cases use HTTP/0.9 for file transfers.
PROTOCOL="hq-interop"
HTTPVERSION="0.9"
# Default enormous flow control.
CONN_FLOW_CONTROL="107374182"
STREAM_FLOW_CONTROL="107374182"
INVOCATIONS=$(echo ${REQUESTS} | tr " " "\n" | awk -F '/' '{ print "/" $4 }' | paste -sd',')
EARLYDATA="false"
PSK_FILE="" # in memory psk
if [ ! -z "${TESTCASE}" ]; then
case "${TESTCASE}" in
"handshake") ;;
"multiconnect") ;;
"transfer")
STREAM_FLOW_CONTROL="262144"
CONN_FLOW_CONTROL="2621440"
;;
"retry")
exit 127
;;
"throughput")
LOGLEVEL=1
;;
"resumption")
INVOCATIONS=$(echo ${INVOCATIONS} | sed -e "s/,/ /")
PSK_FILE="/psk"
;;
"zerortt")
INVOCATIONS=$(echo ${INVOCATIONS} | sed -e "s/,/ /")
PSK_FILE="/psk"
EARLYDATA="true"
;;
"http3")
PROTOCOL="h3"
HTTPVERSION="1.1"
;;
*)
exit 127
;;
esac
fi
if [ "${ROLE}" == "client" ]; then
# Wait for the simulator to start up.
/wait-for-it.sh sim:57832 -s -t 10
echo "Starting QUIC client..."
if [ ! -z "${REQUESTS}" ]; then
REQS=($REQUESTS)
REQ=${REQS[0]}
SERVER=$(echo $REQ | cut -d'/' -f3 | cut -d':' -f1)
for INVOCATION in ${INVOCATIONS}; do
echo "requesting files '${INVOCATION}'"
${HQ_CLI} \
--mode=client \
--host=${SERVER} \
--port=${PORT} \
--protocol=${PROTOCOL} \
--httpversion=${HTTPVERSION} \
--use_version=true \
--quic-version=${VERSION} \
--path="${INVOCATION}" \
--early_data=${EARLYDATA} \
--conn_flow_control=${CONN_FLOW_CONTROL} \
--stream_flow_control=${STREAM_FLOW_CONTROL} \
--outdir=/downloads \
--logdir=/logs \
--qlogger_path=/logs \
--v=${LOGLEVEL} 2>&1 | tee /logs/client.log
done
# This is the best way to troubleshoot.
# Just uncomment the line below, run the test, then enter containers with
# docker exec -it [client|server|sim] /bin/bash
#/bin/bash
fi
elif [ "$ROLE" == "server" ]; then
echo "Running QUIC server on [::]:${PORT}"
${HQ_CLI} \
--mode=server \
--cert=/certs/cert.pem \
--key=/certs/priv.key \
--port=${PORT} \
--httpversion=${HTTPVERSION} \
--h2port=${PORT} \
--static_root=/www \
--logdir=/logs \
--qlogger_path=/logs \
--host=:: \
--congestion=bbr \
--pacing=true \
--v=${LOGLEVEL} 2>&1 | tee /logs/server.log
fi