Clio develop
The XRP Ledger API server.
|
A simple denial of service guard used for rate limiting. More...
#include <DOSGuard.hpp>
Public Member Functions | |
DOSGuard (util::config::ClioConfigDefinition const &config, WhitelistHandlerInterface const &whitelistHandler) | |
Constructs a new DOS guard. | |
bool | isWhiteListed (std::string_view const ip) const noexcept override |
Check whether an ip address is in the whitelist or not. | |
bool | isOk (std::string const &ip) const noexcept override |
Check whether an ip address is currently rate limited or not. | |
void | increment (std::string const &ip) noexcept override |
Increment connection count for the given ip address. | |
void | decrement (std::string const &ip) noexcept override |
Decrement connection count for the given ip address. | |
bool | add (std::string const &ip, uint32_t numObjects) noexcept override |
Adds numObjects of usage for the given ip address. | |
bool | request (std::string const &ip) noexcept override |
Adds one request for the given ip address. | |
void | clear () noexcept override |
Instantly clears all fetch counters added by. | |
![]() | |
![]() |
A simple denial of service guard used for rate limiting.
WhitelistHandlerType | The type of the whitelist handler |
web::dosguard::DOSGuard::DOSGuard | ( | util::config::ClioConfigDefinition const & | config, |
WhitelistHandlerInterface const & | whitelistHandler ) |
Constructs a new DOS guard.
config | Clio config |
whitelistHandler | Whitelist handler that checks whitelist for IP addresses |
|
overridevirtualnoexcept |
Adds numObjects of usage for the given ip address.
If the total sums up to a value equal or larger than maxFetches_ the operation is no longer allowed and false is returned; true is returned otherwise.
ip | |
numObjects |
Implements web::dosguard::DOSGuardInterface.
|
overridevirtualnoexcept |
Instantly clears all fetch counters added by.
Implements web::dosguard::BaseDOSGuard.
|
overridevirtualnoexcept |
Decrement connection count for the given ip address.
ip |
Implements web::dosguard::DOSGuardInterface.
|
overridevirtualnoexcept |
Increment connection count for the given ip address.
ip |
Implements web::dosguard::DOSGuardInterface.
|
nodiscardoverridevirtualnoexcept |
Check whether an ip address is currently rate limited or not.
ip | The ip address to check |
Implements web::dosguard::DOSGuardInterface.
|
nodiscardoverridevirtualnoexcept |
Check whether an ip address is in the whitelist or not.
ip | The ip address to check |
Implements web::dosguard::DOSGuardInterface.
|
overridevirtualnoexcept |
Adds one request for the given ip address.
If the total sums up to a value equal or larger than maxRequestCount_ the operation is no longer allowed and false is returned; true is returned otherwise.
ip |
Implements web::dosguard::DOSGuardInterface.