diff options
| author | stab <stab@stab.ing> | 2026-03-31 04:57:15 +0300 |
|---|---|---|
| committer | frosty <gabriel@bwaaa.monster> | 2026-03-31 05:10:22 +0300 |
| commit | f38fe3c42ec01efe37820b0c00dd79a66c80c0de (patch) | |
| tree | 2af9e878661738d51efee43bbc9998bead3bf078 /src/Limiter/RateLimit.h | |
| parent | c3ed9017385342944badec46de263560c6ab07c8 (diff) | |
| download | omnisearch-f38fe3c42ec01efe37820b0c00dd79a66c80c0de.tar.gz | |
Added rate limiting and settings fixes.
Diffstat (limited to 'src/Limiter/RateLimit.h')
| -rw-r--r-- | src/Limiter/RateLimit.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Limiter/RateLimit.h b/src/Limiter/RateLimit.h new file mode 100644 index 0000000..fabd05d --- /dev/null +++ b/src/Limiter/RateLimit.h @@ -0,0 +1,20 @@ +#ifndef RATE_LIMIT_H +#define RATE_LIMIT_H + +#include <stddef.h> + +typedef struct { + int max_requests; + int interval_seconds; +} RateLimitConfig; + +typedef struct { + int limited; + int retry_after_seconds; +} RateLimitResult; + +void rate_limit_get_client_key(char *client_key, size_t client_key_size); +RateLimitResult rate_limit_check(const char *scope, + const RateLimitConfig *config); + +#endif |
