Skip to content
Snippets Groups Projects
Commit 80565d18 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Merge branch 'feature/#19' into 'main'

#19 Fix TLS and add test

See merge request nicolas.pope/beyond-protocol!4
parents 6d7e3c7f d673ce95
No related branches found
No related tags found
No related merge requests found
...@@ -3,4 +3,6 @@ build ...@@ -3,4 +3,6 @@ build
*.zip *.zip
**/config.cpp **/config.cpp
**/config.h **/config.h
_CPack_Packages _CPack_Packages
\ No newline at end of file .vscode
.env
\ No newline at end of file
#include <loguru.hpp> #include <loguru.hpp>
#include <ftl/exception.hpp> #include <ftl/exception.hpp>
#include <ftl/protocol/config.h>
#include "connection.hpp" #include "connection.hpp"
#include "tcp.hpp" #include "tcp.hpp"
......
...@@ -6,8 +6,10 @@ ...@@ -6,8 +6,10 @@
#include <iomanip> #include <iomanip>
#include <ftl/exception.hpp> #include <ftl/exception.hpp>
#include <ftl/lib/loguru.hpp>
using ftl::net::internal::Connection_TLS; using ftl::net::internal::Connection_TLS;
using uchar = unsigned char;
/** get basic certificate info: Distinguished Name (DN), issuer DN, /** get basic certificate info: Distinguished Name (DN), issuer DN,
* certificate fingerprint */ * certificate fingerprint */
......
#ifndef _FTL_NET_TLS_HPP_ #pragma once
#define _FTL_NET_TLS_HPP_
#include <ftl/protocol/config.h>
#ifdef HAVE_GNUTLS #ifdef HAVE_GNUTLS
...@@ -44,4 +45,3 @@ private: ...@@ -44,4 +45,3 @@ private:
} }
#endif // HAVE_GNUTLS #endif // HAVE_GNUTLS
#endif // _FTL_NET_TLS_HPP_
...@@ -81,4 +81,15 @@ target_include_directories(stream_integration PUBLIC "${CMAKE_CURRENT_SOURCE_DIR ...@@ -81,4 +81,15 @@ target_include_directories(stream_integration PUBLIC "${CMAKE_CURRENT_SOURCE_DIR
target_link_libraries(stream_integration target_link_libraries(stream_integration
beyond-protocol GnuTLS::GnuTLS Threads::Threads ${URIPARSER_LIBRARIES} ${UUID_LIBRARIES} ${OS_LIBS}) beyond-protocol GnuTLS::GnuTLS Threads::Threads ${URIPARSER_LIBRARIES} ${UUID_LIBRARIES} ${OS_LIBS})
add_test(StreamIntegrationTest stream_integration) add_test(StreamIntegrationTest stream_integration)
\ No newline at end of file
### Webservice E2E #############################################################
add_executable(webservice_e2e
$<TARGET_OBJECTS:CatchTestFTL>
./webservice_e2e.cpp
)
target_include_directories(webservice_e2e PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../include")
target_link_libraries(webservice_e2e
beyond-protocol GnuTLS::GnuTLS Threads::Threads ${URIPARSER_LIBRARIES} ${UUID_LIBRARIES} ${OS_LIBS})
add_test(WebserviceE2ETest webservice_e2e)
\ No newline at end of file
#include "catch.hpp"
#include <ftl/protocol.hpp>
#include <ftl/protocol/self.hpp>
#include <ftl/protocol/node.hpp>
#include <ftl/uri.hpp>
// --- Tests -------------------------------------------------------------------
TEST_CASE("Webservice connection", "[net]") {
SECTION("connect using secure websocket") {
std::string uri;
if(const char* env_p = std::getenv("FTL_WEBSERVICE_URI")) {
uri = std::string(env_p);
} else {
return;
}
auto p = ftl::connectNode(uri);
REQUIRE( p );
REQUIRE( p->waitConnection(5) );
}
ftl::protocol::reset();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment