Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
web::dosguard::WhitelistHandler Class Reference

A simple handler to add/check elements in a whitelist. More...

#include <WhitelistHandler.hpp>

Inheritance diagram for web::dosguard::WhitelistHandler:
Collaboration diagram for web::dosguard::WhitelistHandler:

Public Member Functions

 WhitelistHandler (Whitelist whitelist)
 Constructs a WhitelistHandler from an already-built Whitelist.
bool isWhiteListed (std::string_view ip) const override
 Checks to see if the given IP is whitelisted.
Public Member Functions inherited from web::dosguard::WhitelistHandlerInterface
virtual ~WhitelistHandlerInterface ()=default
 Virtual destructor.

Static Public Member Functions

template<SomeResolver HostnameResolverType = Resolver>
static std::expected< WhitelistHandler, std::string > create (util::config::ClioConfigDefinition const &config, HostnameResolverType &&resolver={})
 Creates a WhitelistHandler by loading all whitelisted IPs and masks from config.

Detailed Description

A simple handler to add/check elements in a whitelist.

Constructor & Destructor Documentation

◆ WhitelistHandler()

web::dosguard::WhitelistHandler::WhitelistHandler ( Whitelist whitelist)
explicit

Constructs a WhitelistHandler from an already-built Whitelist.

Parameters
whitelistThe whitelist to use

Member Function Documentation

◆ create()

template<SomeResolver HostnameResolverType = Resolver>
std::expected< WhitelistHandler, std::string > web::dosguard::WhitelistHandler::create ( util::config::ClioConfigDefinition const & config,
HostnameResolverType && resolver = {} )
inlinestatic

Creates a WhitelistHandler by loading all whitelisted IPs and masks from config.

Parameters
configThe Clio config to use
resolverThe resolver to use for hostname resolution
Returns
The WhitelistHandler on success, or an error string if any whitelist entry is invalid

◆ isWhiteListed()

bool web::dosguard::WhitelistHandler::isWhiteListed ( std::string_view ip) const
inlinenodiscardoverridevirtual

Checks to see if the given IP is whitelisted.

Parameters
ipThe IP to check
Returns
true if the given IP is whitelisted; false otherwise

Implements web::dosguard::WhitelistHandlerInterface.


The documentation for this class was generated from the following files:
  • /__w/clio/clio/src/web/dosguard/WhitelistHandler.hpp
  • /__w/clio/clio/src/web/dosguard/WhitelistHandler.cpp