Clio
develop
The XRP Ledger API server.
Theme:
Default
Round
Robot
Toggle main menu visibility
Loading...
Searching...
No Matches
DOSGuardInterface.hpp
1
#pragma once
2
3
#include <boost/json/object.hpp>
4
5
#include <cstdint>
6
#include <string>
7
#include <string_view>
8
namespace
web::dosguard
{
9
13
class
BaseDOSGuard
{
14
public
:
15
virtual
~BaseDOSGuard
() =
default
;
16
20
virtual
void
21
clear
() noexcept = 0;
22
};
23
27
class
DOSGuardInterface
: public
BaseDOSGuard
{
28
public
:
36
[[nodiscard]]
virtual
bool
37
isWhiteListed
(std::string_view
const
ip)
const
noexcept
= 0;
38
46
[[nodiscard]]
virtual
bool
47
isOk
(std::string
const
& ip)
const
noexcept
= 0;
48
54
virtual
void
55
increment
(std::string
const
& ip)
noexcept
= 0;
56
62
virtual
void
63
decrement
(std::string
const
& ip)
noexcept
= 0;
64
77
[[maybe_unused]]
virtual
bool
78
add
(std::string
const
& ip, uint32_t numObjects)
noexcept
= 0;
79
90
[[maybe_unused]]
virtual
bool
91
request
(std::string
const
& ip, boost::json::object
const
&
request
) = 0;
92
};
93
94
}
// namespace web::dosguard
web::dosguard::BaseDOSGuard
The interface of a denial of service guard.
Definition
DOSGuardInterface.hpp:13
web::dosguard::BaseDOSGuard::clear
virtual void clear() noexcept=0
Clears implementation-defined counters.
web::dosguard::DOSGuardInterface
The interface of a denial of service guard.
Definition
DOSGuardInterface.hpp:27
web::dosguard::DOSGuardInterface::isWhiteListed
virtual bool isWhiteListed(std::string_view const ip) const noexcept=0
Check whether an ip address is in the whitelist or not.
web::dosguard::DOSGuardInterface::request
virtual bool request(std::string const &ip, boost::json::object const &request)=0
Adds one request for the given ip address.
web::dosguard::DOSGuardInterface::decrement
virtual void decrement(std::string const &ip) noexcept=0
Decrement connection count for the given ip address.
web::dosguard::DOSGuardInterface::increment
virtual void increment(std::string const &ip) noexcept=0
Increment connection count for the given ip address.
web::dosguard::DOSGuardInterface::add
virtual bool add(std::string const &ip, uint32_t numObjects) noexcept=0
Adds numObjects of usage for the given ip address.
web::dosguard::DOSGuardInterface::isOk
virtual bool isOk(std::string const &ip) const noexcept=0
Check whether an ip address is currently rate limited or not.
web::dosguard
Denial of service protection: rate limiting, IP whitelisting and request weighting.
Definition
DOSGuard.cpp:22
src
web
dosguard
DOSGuardInterface.hpp
Generated by
1.17.0