-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_tls.sh
executable file
·38 lines (29 loc) · 949 Bytes
/
test_tls.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
#!/bin/bash
# Kill any existing test servers
pkill -f "test_tls" > /dev/null 2>&1
# Go to the correct directory
cd "$(dirname "$0")"
# Build the test programs
echo "Building TLS test program..."
cd test_tls
go build -o test_tls main.go
cd ..
# Start the test TLS server
echo "Starting TLS server..."
cd test_tls
./test_tls > server.log 2>&1 &
SERVER_PID=$!
cd ..
# Wait for the server to start
sleep 2
# Test with our test client
echo "Testing with Go client..."
cd test_tls
./test_tls client
# Test with OpenSSL
echo -e "\nTesting with OpenSSL..."
echo -e "OPTIONS sip:127.0.0.1:5063 SIP/2.0\r\nVia: SIP/2.0/TLS 127.0.0.1:9999;branch=z9hG4bK-test\r\nTo: <sip:[email protected]>\r\nFrom: <sip:[email protected]>;tag=test123\r\nCall-ID: test-call-id\r\nCSeq: 1 OPTIONS\r\nMax-Forwards: 70\r\nContent-Length: 0\r\n\r\n" | openssl s_client -connect 127.0.0.1:5063 -quiet
# Clean up
echo -e "\nCleaning up..."
kill $SERVER_PID
echo "Test complete!"