config add rate limit

This commit is contained in:
Flam3rboy 2021-08-12 18:57:43 +02:00
parent aba41d4b4f
commit 407faf77c8

View File

@ -20,8 +20,10 @@ export default {
}; };
export interface RateLimitOptions { export interface RateLimitOptions {
bot?: number;
count: number; count: number;
timespan: number; window: number;
onyIp?: boolean;
} }
export interface Region { export interface Region {
@ -78,15 +80,16 @@ export interface DefaultOptions {
maxTopic: number; maxTopic: number;
}; };
rate: { rate: {
ip: { ip: Omit<RateLimitOptions, "bot_count">;
enabled: boolean; global: RateLimitOptions;
count: number; error: RateLimitOptions;
timespan: number;
};
routes: { routes: {
auth?: { guild: RateLimitOptions;
login?: RateLimitOptions; webhook: RateLimitOptions;
register?: RateLimitOptions; channel: RateLimitOptions;
auth: {
login: RateLimitOptions;
register: RateLimitOptions;
}; };
// TODO: rate limit configuration for all routes // TODO: rate limit configuration for all routes
}; };
@ -183,11 +186,42 @@ export const DefaultOptions: DefaultOptions = {
}, },
rate: { rate: {
ip: { ip: {
enabled: true, count: 500,
count: 1000, window: 5,
timespan: 1000 * 60 * 10, },
global: {
count: 20,
window: 5,
bot: 250,
},
error: {
count: 10,
window: 5,
},
routes: {
guild: {
count: 5,
window: 5,
},
webhook: {
count: 5,
window: 5,
},
channel: {
count: 5,
window: 5,
},
auth: {
login: {
count: 5,
window: 60,
},
register: {
count: 2,
window: 60 * 60 * 12,
},
},
}, },
routes: {},
}, },
}, },
security: { security: {