Clio develop
The XRP Ledger API server.
|
Implementation of WeightsInterface that manages command weights for DosGuard. More...
#include <Weights.hpp>
Classes | |
struct | Entry |
Structure representing weight configuration for a command. More... | |
Public Member Functions | |
Weights (size_t defaultWeight, std::unordered_map< std::string, Entry > weights) | |
Construct a new Weights object. | |
size_t | requestWeight (boost::json::object const &request) const override |
Get the weight assigned to a specific command. | |
![]() |
Static Public Member Functions | |
static Weights | make (util::config::ClioConfigDefinition const &config) |
Create a Weights object from configuration. | |
Implementation of WeightsInterface that manages command weights for DosGuard.
This class provides a mechanism to assign different weights to API commands for the purpose of DOS protection calculations. Commands can have specific weights, or fall back to a default weight.
web::dosguard::Weights::Weights | ( | size_t | defaultWeight, |
std::unordered_map< std::string, Entry > | weights ) |
Construct a new Weights object.
defaultWeight | The default weight to use when a command-specific weight is not defined |
weights | Map of command names to their specific weights |
|
static |
|
overridevirtual |
Get the weight assigned to a specific command.
request | Json request |
Implements web::dosguard::WeightsInterface.