From 7ac2d7688e5f0df7b7fa05798d254831c249da9b Mon Sep 17 00:00:00 2001 From: sha512sum Date: Sat, 31 Aug 2024 18:17:53 +0000 Subject: [PATCH] Add proxy types --- library/include/larra/proxy.hpp | 39 +++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 library/include/larra/proxy.hpp diff --git a/library/include/larra/proxy.hpp b/library/include/larra/proxy.hpp new file mode 100644 index 0000000..3f365ff --- /dev/null +++ b/library/include/larra/proxy.hpp @@ -0,0 +1,39 @@ +#pragma once +#include +#include + +namespace larra::xmpp { + +struct HttpProxy { + std::string hostname; + std::uint16_t port; + template + constexpr auto Hostname(this Self&& self, std::string hostname) -> HttpProxy { + return utils::FieldSetHelper::With<"hostname", HttpProxy>(std::forward(self), std::move(hostname)); + } + template + constexpr auto Port(this Self&& self, std::uint16_t port) -> HttpProxy { + return utils::FieldSetHelper::With<"port", HttpProxy>(std::forward(self), port); + } +}; + +struct Socks5Proxy { + std::string hostname; + std::uint16_t port; + template + constexpr auto Hostname(this Self&& self, std::string hostname) -> Socks5Proxy { + return utils::FieldSetHelper::With<"hostname", Socks5Proxy>(std::forward(self), std::move(hostname)); + } + template + constexpr auto Port(this Self&& self, std::uint16_t port) -> Socks5Proxy { + return utils::FieldSetHelper::With<"port", Socks5Proxy>(std::forward(self), port); + } +}; + +struct NoProxy {}; + +struct SystemConfiguredProxy {}; + +using Proxy = std::variant; + +} // namespace larra::xmpp