Network System 0.1.1
High-performance modular networking library for scalable client-server applications
Loading...
Searching...
No Matches
tls_policy.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2024, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
11#pragma once
12
21#include <concepts>
22#include <string>
23#include <type_traits>
24
26
39struct no_tls {
40 static constexpr bool enabled = false;
41};
42
62 static constexpr bool enabled = true;
63
64 std::string cert_path{};
65 std::string key_path{};
66 std::string ca_path{};
67 bool verify_peer{true};
68};
69
87template <typename T>
88concept TlsPolicy = requires {
89 { T::enabled } -> std::convertible_to<bool>;
90};
91
95template <TlsPolicy Policy>
96inline constexpr bool is_tls_enabled_v = Policy::enabled;
97
101template <TlsPolicy Policy>
102struct is_tls_enabled : std::bool_constant<Policy::enabled> {};
103
104} // namespace kcenon::network::policy
Concept that constrains types to be valid TLS policies.
Definition tls_policy.h:88
constexpr bool is_tls_enabled_v
Helper variable template to check if TLS is enabled at compile time.
Definition tls_policy.h:96
Type trait to check if a policy enables TLS.
Definition tls_policy.h:102
Policy type indicating no TLS/SSL encryption.
Definition tls_policy.h:39
static constexpr bool enabled
Definition tls_policy.h:40
Policy type indicating TLS/SSL encryption is enabled.
Definition tls_policy.h:61
static constexpr bool enabled
Definition tls_policy.h:62