20 static std::optional<IpNetwork>
parse(std::string_view text);
37 std::string
header =
"X-Forwarded-For";
An IPv4 or IPv6 network ("10.0.0.0/8", "::1", "fd00::/8"). IPv4 addresses are stored IPv4-mapped,...
Definition TrustedProxies.hpp:17
static std::optional< IpNetwork > parse(std::string_view text)
Parses an address or CIDR; std::nullopt if malformed.
bool contains(std::string_view ip) const
True if ip (a literal address) is inside this network.
int prefix_bits_
Definition TrustedProxies.hpp:26
std::array< uint8_t, 16 > address_
Definition TrustedProxies.hpp:25
routing::Middleware trusted_proxies(TrustedProxyOptions options)
Sets req.client_ip from forwarding headers, but only for requests that arrive from a trusted proxy.
Definition HttpRequest.hpp:19
std::function< bool(http::HttpRequest &, std::shared_ptr< http::ResponseWriter >)> Middleware
Definition Router.hpp:19
Options for trusted_proxies().
Definition TrustedProxies.hpp:32
std::vector< std::string > proxies
Definition TrustedProxies.hpp:35
std::string header
"X-Forwarded-For" (default) or "Forwarded" (RFC 7239).
Definition TrustedProxies.hpp:37