File tree 3 files changed +44
-0
lines changed
samples/secure_tunneling/secure_tunnel
3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ phases:
16
16
- echo Build started on `date`
17
17
- $CODEBUILD_SRC_DIR/codebuild/samples/setup-linux.sh
18
18
- $CODEBUILD_SRC_DIR/codebuild/samples/pubsub-linux.sh
19
+ - $CODEBUILD_SRC_DIR/codebuild/samples/securetunnel-linux.sh
19
20
post_build :
20
21
commands :
21
22
- echo Build completed on `date`
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+
5
+ env
6
+
7
+ pushd $CODEBUILD_SRC_DIR /samples/secure_tunneling/secure_tunnel
8
+
9
+ mkdir _build
10
+ cd _build
11
+ cmake -DCMAKE_PREFIX_PATH=/tmp/install ..
12
+ make -j
13
+
14
+ echo " aws iotsecuretunneling open-tunnel"
15
+ RESPONSE=$( aws iotsecuretunneling open-tunnel)
16
+ array=(${RESPONSE//:/ } )
17
+
18
+ echo " Assigning SOURCETOKEN"
19
+ SOURCETOKEN=" ${array[11]} "
20
+
21
+ echo " Assigning DESTINATIONTOKEN"
22
+ DESTINATIONTOKEN=" ${array[13]} "
23
+
24
+ echo " Secure Tunnel Destination test"
25
+ ./secure-tunnel --test --region us-east-1 --access_token $DESTINATIONTOKEN &
26
+ sleep 10 &
27
+
28
+ echo " Secure Tunnel Source test"
29
+ ./secure-tunnel --localProxyModeSource --region us-east-1 --access_token $SOURCETOKEN &
Original file line number Diff line number Diff line change @@ -78,6 +78,12 @@ int main(int argc, char *argv[])
78
78
string proxyUserName;
79
79
string proxyPassword;
80
80
81
+ /*
82
+ * For internal testing
83
+ */
84
+ bool isTest = s_cmdOptionExists (argv, argv + argc, " --test" );
85
+ int expectedMessageCount = 5 ;
86
+
81
87
std::shared_ptr<SecureTunnel> secureTunnel;
82
88
83
89
/* ********************** Parse Arguments ***************************/
@@ -267,6 +273,14 @@ int main(int argc, char *argv[])
267
273
fprintf (stdout, " Data Receive Complete in Destination\n " );
268
274
fprintf (stdout, " Sending response message:\" %s\"\n " , returnMessage.c_str ());
269
275
secureTunnel->SendData (ByteCursorFromCString (returnMessage.c_str ()));
276
+ if (isTest)
277
+ {
278
+ expectedMessageCount--;
279
+ if (expectedMessageCount == 0 )
280
+ {
281
+ exit (0 );
282
+ }
283
+ }
270
284
break ;
271
285
case AWS_SECURE_TUNNELING_SOURCE_MODE:
272
286
fprintf (stdout, " Data Receive Complete in Source\n " );
You can’t perform that action at this time.
0 commit comments