diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5aaea4..d4d283b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -169,7 +169,7 @@ jobs: run: | mkdir build cd build - cmake -DBUILD_TESTS=OFF -DBOOST_PKG_VERSION=1.84.0 -DWIN32_WINNT=0x0601 -DBoost_USE_STATIC_LIBS=ON -DCMAKE_PREFIX_PATH="C:\Boost;C:\Program Files (x86)\Catch2;C:\Program Files (x86)\protobuf;C:\Program Files\OpenSSL" -G "Visual Studio 16 2019" -A x64 ..\ + cmake -DBUILD_TESTS=OFF -DLINK_STATIC_OPENSSL=OFF -DBOOST_PKG_VERSION=1.84.0 -DWIN32_WINNT=0x0601 -DBoost_USE_STATIC_LIBS=ON -DCMAKE_PREFIX_PATH="C:\Boost;C:\Program Files (x86)\Catch2;C:\Program Files (x86)\protobuf;C:\Program Files\OpenSSL" -G "Visual Studio 16 2019" -A x64 ..\ msbuild localproxy.vcxproj -p:Configuration=Release - name: Upload Artifact uses: actions/upload-artifact@v3 diff --git a/CMakeLists.txt b/CMakeLists.txt index f7fd445..3550894 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,8 @@ set(AWS_TUNNEL_LOCAL_PROXY_TARGET_NAME localproxy) set(AWS_TUNNEL_LOCAL_PROXY_LIB_NAME lproxy) project(${AWS_TUNNEL_LOCAL_PROXY_TARGET_NAME} CXX) -option(BUILD_TESTS "Build tests" ON) +option(BUILD_TESTS "Build tests" OFF) +option(LINK_STATIC_OPENSSL "Use static openssl libs" ON) if(BUILD_TESTS) set(AWS_TUNNEL_LOCAL_PROXY_TEST_NAME localproxytest) project(${AWS_TUNNEL_LOCAL_PROXY_TEST_NAME} CXX) @@ -115,9 +116,13 @@ endif() include_directories(${PROJECT_SOURCE_DIR}/src) target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TARGET_NAME} ${CMAKE_THREAD_LIBS_INIT}) -# target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TARGET_NAME} OpenSSL::SSL) -# target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TARGET_NAME} OpenSSL::Crypto) -### uncomment above 2 lines and remove below 2 lines to link against OpenSSL shared libs +if(LINK_STATIC_OPENSSL) + target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TARGET_NAME} ${OpenSSL_STATIC_SSL_LIBRARY}) + target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TARGET_NAME} ${OpenSSL_STATIC_CRYPTO_LIBRARY}) +else() + target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TARGET_NAME} OpenSSL::SSL) + target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TARGET_NAME} OpenSSL::Crypto) +endif() target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TARGET_NAME} ${OpenSSL_STATIC_SSL_LIBRARY}) target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TARGET_NAME} ${OpenSSL_STATIC_CRYPTO_LIBRARY}) target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TARGET_NAME} ${Boost_STATIC_LIBRARIES}) @@ -127,9 +132,13 @@ set_property(TARGET ${AWS_TUNNEL_LOCAL_PROXY_TARGET_NAME} APPEND_STRING PROPERTY if(BUILD_TESTS) target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TEST_NAME} ${CMAKE_THREAD_LIBS_INIT}) - # target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TEST_NAME} OpenSSL::SSL) - # target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TEST_NAME} OpenSSL::Crypto) - ### uncomment above 2 lines and remove below 2 lines to link against OpenSSL shared libs + if(LINK_STATIC_OPENSSL) + target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TEST_NAME} ${OpenSSL_STATIC_SSL_LIBRARY}) + target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TEST_NAME} ${OpenSSL_STATIC_CRYPTO_LIBRARY}) + else() + target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TEST_NAME} OpenSSL::SSL) + target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TEST_NAME} OpenSSL::Crypto) + endif() target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TEST_NAME} ${OpenSSL_STATIC_SSL_LIBRARY}) target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TEST_NAME} ${OpenSSL_STATIC_CRYPTO_LIBRARY}) target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TEST_NAME} ${Boost_STATIC_LIBRARIES}) diff --git a/src/TcpAdapterProxy.cpp b/src/TcpAdapterProxy.cpp index 394a45c..48dd722 100644 --- a/src/TcpAdapterProxy.cpp +++ b/src/TcpAdapterProxy.cpp @@ -2103,7 +2103,7 @@ namespace aws { namespace iot { namespace securedtunneling { string endpoint = tac.adapter_config.serviceId_to_endpoint_map[service_id]; BOOST_LOG_SEV(log, error) << (boost::format("Could not resolve endpoint %1%. Error message: %2%") % endpoint % ec.message()).str(); basic_retry_execute(log, retry_config, - [this, &tac, service_id, connection_id]() + [this, &tac, service_id]() { BOOST_LOG_SEV(log, trace) << "resetting stream for service id:" << service_id << ", then listen for stream start"; async_send_stream_reset(tac, service_id); @@ -2122,7 +2122,7 @@ namespace aws { namespace iot { namespace securedtunneling { { BOOST_LOG_SEV(log, error) << (boost::format("Could not connect to destination %1%:%2% -- %3%") % dst_host % dst_port % ec.message()).str(); basic_retry_execute(log, retry_config, - [this, &tac, service_id, connection_id]() + [this, &tac, service_id]() { BOOST_LOG_SEV(log, trace) << "resetting stream for service id:" << service_id << ", then listen for stream start"; async_send_stream_reset(tac, service_id); @@ -2183,7 +2183,7 @@ namespace aws { namespace iot { namespace securedtunneling { { BOOST_LOG_SEV(log, error) << (boost::format("Could not resolve bind address: %1% -- %2%") % tac.adapter_config.bind_address.get() % ec.message()).str(); basic_retry_execute(log, retry_config, - [this, &tac, service_id, connection_id]() + [this, &tac, service_id]() { BOOST_LOG_SEV(log, trace) << "resetting stream for service id:" << service_id << ", then listen for stream start"; async_send_stream_reset(tac, service_id);