22#include "util/config/ConfigDefinition.hpp"
23#include "util/config/ValueView.hpp"
25#include <boost/beast/http/field.hpp>
26#include <boost/beast/http/message.hpp>
27#include <boost/beast/http/string_body.hpp>
28#include <xrpl/basics/base_uint.h>
33#include <unordered_set>
45 std::unordered_set<std::string> proxyIps_;
47 std::unordered_set<ripple::uint256, ripple::uint256::hasher> proxyTokens_;
56 ProxyIpResolver(std::unordered_set<std::string> proxyIps, std::unordered_set<std::string> proxyTokens);
69 using HttpHeaders = boost::beast::http::request<boost::beast::http::string_body>::header_type;
71 static constexpr std::string_view kPROXY_TOKEN_HEADER =
"X-Proxy-Token";
85 resolveClientIp(std::string
const& connectionIp, HttpHeaders
const& headers)
const;
97 static std::optional<std::string>
98 extractClientIp(HttpHeaders
const& headers);
All the config data will be stored and extracted from this class.
Definition ConfigDefinition.hpp:50
Resolves the client's IP address, considering proxy servers.
Definition ProxyIpResolver.hpp:44
std::string resolveClientIp(std::string const &connectionIp, HttpHeaders const &headers) const
Resolves the client's IP address from the connection IP and HTTP headers.
Definition ProxyIpResolver.cpp:67
ProxyIpResolver(std::unordered_set< std::string > proxyIps, std::unordered_set< std::string > proxyTokens)
Constructs a ProxyIpResolver.
Definition ProxyIpResolver.cpp:37
static ProxyIpResolver fromConfig(util::config::ClioConfigDefinition const &config)
Creates a ProxyIpResolver from a configuration.
Definition ProxyIpResolver.cpp:47
This namespace implements the web server and related components.
Definition Types.hpp:43