Manages rate limiting for WebSocket requests based on predefined limits.
More...
#include <WebSocketRateLimiter.hpp>
|
bool | check_limit (long rate_limit_id) |
| Checks if a request is allowed under the specified rate limit without updating the count.
|
|
void | update_limit (long rate_limit_id) |
| Updates the request count for the specified rate limit ID.
|
|
Manages rate limiting for WebSocket requests based on predefined limits.
The limiter applies a general rate limit (id 0) to all requests by default.
Definition at line 13 of file WebSocketRateLimiter.hpp.
◆ time_point_t
◆ allow_request()
bool kurlyk::WebSocketRateLimiter::allow_request |
( |
long | rate_limit_id | ) |
|
|
inline |
Checks if a request is allowed under the specified rate limit.
- Parameters
-
rate_limit_id | The ID of the rate limit category to apply. |
- Returns
- true if the request is allowed, false if the request exceeds the limit.
Definition at line 41 of file WebSocketRateLimiter.hpp.
◆ check_limit()
bool kurlyk::WebSocketRateLimiter::check_limit |
( |
long | rate_limit_id | ) |
|
|
inlineprivate |
Checks if a request is allowed under the specified rate limit without updating the count.
- Parameters
-
rate_limit_id | The ID of the rate limit to apply. |
- Returns
- true if the request is allowed, false if the request exceeds the limit.
Definition at line 81 of file WebSocketRateLimiter.hpp.
◆ set_limit()
Sets the rate limits to control WebSocket request frequency.
- Parameters
-
rate_limits | A vector of rate limit configurations for different request categories. |
Definition at line 19 of file WebSocketRateLimiter.hpp.
◆ update_limit()
void kurlyk::WebSocketRateLimiter::update_limit |
( |
long | rate_limit_id | ) |
|
|
inlineprivate |
Updates the request count for the specified rate limit ID.
- Parameters
-
rate_limit_id | The ID of the rate limit to apply. |
Definition at line 101 of file WebSocketRateLimiter.hpp.
◆ m_limit_data
std::vector<LimitData> kurlyk::WebSocketRateLimiter::m_limit_data |
|
private |
◆ m_mutex
std::mutex kurlyk::WebSocketRateLimiter::m_mutex |
|
private |
The documentation for this class was generated from the following file: