m-lab / ndt-server

docker native ndt5 and ndt7 server with prometheus integration
https://www.measurementlab.net/
Apache License 2.0
99 stars 40 forks source link

Minimal download test using CURL #393

Open stephen-soltesz opened 1 year ago

stephen-soltesz commented 1 year ago
read MACHINE SERVER_URL <<< $( \
    curl --silent https://locate.measurementlab.net/v2/nearest/ndt/ndt7 \
      | jq -r '.results[0].machine,.results[0].urls."wss:///ndt/v7/download"' ) 

# Fix url for curl.                                                             
SERVER_URL=${SERVER_URL/wss/https}                                              

echo "NDT Download to $MACHINE"
curl --no-buffer \
    --max-time 12 \
    --header "Sec-WebSocket-Protocol: net.measurementlab.ndt.v7" \
    --header "Connection: Upgrade" \
    --header "Upgrade: websocket" \
    --header "Host: ndt-$MACHINE" \
    --header "Origin: https://ndt-$MACHINE" \
    --header "Sec-WebSocket-Version: 13" \
    --header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
    ${SERVER_URL} > /dev/null || : # ignore timeouts.