test-connect.sh: initial commit

This commit is contained in:
Ryan Heywood 2025-08-31 22:49:57 -04:00
parent 622e718107
commit 82c331af18
Signed by: ryan
GPG Key ID: 8E401478A3FBEF72
1 changed files with 17 additions and 0 deletions

17
test-connect.sh Normal file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
SOCAT_PID=
cleanup_socat() {
if test ! -z "$SOCAT_PID"; then
kill "$SOCAT_PID"
fi
}
ENCLAVE_CID=$(nitro-cli describe-enclaves | jq -r ".[0].EnclaveCID")
socat TCP4-LISTEN:3000,reuseaddr,fork VSOCK-CONNECT:$ENCLAVE_CID:3000 &
SOCAT_PID="$!"
curl -k https://localhost:3000; echo
trap cleanup_socat EXIT