From 362002664511ba33660d67c2e085231351e100c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Arturo=20Cabral=20Mej=C3=ADa?= Date: Thu, 22 Dec 2022 21:26:04 -0500 Subject: [PATCH] feat: add rate limit whitelists for pubkeys/ips --- settings.sample.json | 9 ++++++++- src/@types/settings.ts | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/settings.sample.json b/settings.sample.json index 98643d2..a5fb659 100644 --- a/settings.sample.json +++ b/settings.sample.json @@ -73,7 +73,14 @@ "period": 86400000, "rate": 2880 } - ] + ], + "whitelists": { + "pubkeys": [], + "ipAddresses": [ + "::1", + "::ffff:10.10.10.1" + ] + } }, "client": { "subscription": { diff --git a/src/@types/settings.ts b/src/@types/settings.ts index b927e97..7e698c2 100644 --- a/src/@types/settings.ts +++ b/src/@types/settings.ts @@ -52,6 +52,11 @@ export interface ContentLimits { maxLength?: number } +export interface EventWhitelists { + pubkeys?: Pubkey[] + ipAddresses?: string[] +} + export interface EventLimits { eventId?: EventIdLimits pubkey?: PubkeyLimits @@ -59,6 +64,7 @@ export interface EventLimits { createdAt?: CreatedAtLimits content?: ContentLimits rateLimits?: EventRateLimit[] + whitelists?: EventWhitelists } export interface ClientSubscriptionLimits {