The interface of a denial of service guard.
More...
#include <DOSGuardInterface.hpp>
|
| virtual bool | isWhiteListed (std::string_view const ip) const noexcept=0 |
| | Check whether an ip address is in the whitelist or not.
|
| virtual bool | isOk (std::string const &ip) const noexcept=0 |
| | Check whether an ip address is currently rate limited or not.
|
| virtual void | increment (std::string const &ip) noexcept=0 |
| | Increment connection count for the given ip address.
|
| virtual void | decrement (std::string const &ip) noexcept=0 |
| | Decrement connection count for the given ip address.
|
| virtual bool | add (std::string const &ip, uint32_t numObjects) noexcept=0 |
| | Adds numObjects of usage for the given ip address.
|
| virtual bool | request (std::string const &ip, boost::json::object const &request)=0 |
| | Adds one request for the given ip address.
|
| virtual void | clear () noexcept=0 |
| | Clears implementation-defined counters.
|
The interface of a denial of service guard.
◆ add()
| virtual bool web::dosguard::DOSGuardInterface::add |
( |
std::string const & | ip, |
|
|
uint32_t | numObjects ) |
|
pure virtualnoexcept |
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.
- Parameters
-
- Returns
- true
-
false
Implemented in web::dosguard::DOSGuard.
◆ decrement()
| virtual void web::dosguard::DOSGuardInterface::decrement |
( |
std::string const & | ip | ) |
|
|
pure virtualnoexcept |
◆ increment()
| virtual void web::dosguard::DOSGuardInterface::increment |
( |
std::string const & | ip | ) |
|
|
pure virtualnoexcept |
◆ isOk()
| virtual bool web::dosguard::DOSGuardInterface::isOk |
( |
std::string const & | ip | ) |
const |
|
nodiscardpure virtualnoexcept |
Check whether an ip address is currently rate limited or not.
- Parameters
-
| ip | The ip address to check |
- Returns
- true If not rate limited
-
false If rate limited and the request should not be processed
Implemented in web::dosguard::DOSGuard.
◆ isWhiteListed()
| virtual bool web::dosguard::DOSGuardInterface::isWhiteListed |
( |
std::string_view const | ip | ) |
const |
|
nodiscardpure virtualnoexcept |
Check whether an ip address is in the whitelist or not.
- Parameters
-
| ip | The ip address to check |
- Returns
- true
-
false
Implemented in web::dosguard::DOSGuard.
◆ request()
| virtual bool web::dosguard::DOSGuardInterface::request |
( |
std::string const & | ip, |
|
|
boost::json::object const & | request ) |
|
pure virtual |
Adds one request for the given ip address.
- Parameters
-
| ip | |
| request | The request as json object |
- Returns
- 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.
Implemented in web::dosguard::DOSGuard.
The documentation for this class was generated from the following file: