Add proxy types
This commit is contained in:
parent
3f04552491
commit
7ac2d7688e
1 changed files with 39 additions and 0 deletions
39
library/include/larra/proxy.hpp
Normal file
39
library/include/larra/proxy.hpp
Normal file
|
@ -0,0 +1,39 @@
|
|||
#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
|
Loading…
Reference in a new issue