larra/library/include/larra/proxy.hpp
2024-08-31 18:38:41 +00:00

39 lines
1.2 KiB
C++

#pragma once
#include <larra/utils.hpp>
#include <variant>
namespace larra::xmpp {
struct HttpProxy {
std::string hostname;
std::uint16_t port;
template <typename Self>
constexpr auto Hostname(this Self&& self, std::string hostname) -> HttpProxy {
return utils::FieldSetHelper::With<"hostname", HttpProxy>(std::forward<Self>(self), std::move(hostname));
}
template <typename Self>
constexpr auto Port(this Self&& self, std::uint16_t port) -> HttpProxy {
return utils::FieldSetHelper::With<"port", HttpProxy>(std::forward<Self>(self), port);
}
};
struct Socks5Proxy {
std::string hostname;
std::uint16_t port;
template <typename Self>
constexpr auto Hostname(this Self&& self, std::string hostname) -> Socks5Proxy {
return utils::FieldSetHelper::With<"hostname", Socks5Proxy>(std::forward<Self>(self), std::move(hostname));
}
template <typename Self>
constexpr auto Port(this Self&& self, std::uint16_t port) -> Socks5Proxy {
return utils::FieldSetHelper::With<"port", Socks5Proxy>(std::forward<Self>(self), port);
}
};
struct NoProxy {};
struct SystemConfiguredProxy {};
using Proxy = std::variant<SystemConfiguredProxy, HttpProxy, Socks5Proxy, NoProxy>;
} // namespace larra::xmpp