mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-09 14:26:27 +00:00
a00f350cd1
* feat: Added simple, configurable rate limit for lightpush and store-query Adjust lightpush rest response to rate limit, added tests ann some fixes Add rest store query test for rate limit checks and proper error response Update apps/wakunode2/external_config.nim Move chronos/tokenbucket to nwaku codebasee with limited and fixed feature set Add meterics counter to lightpush rate limits Co-authored-by: gabrielmer <101006718+gabrielmer@users.noreply.github.com>
18 lines
467 B
Nim
18 lines
467 B
Nim
when (NimMajor, NimMinor) < (1, 4):
|
|
{.push raises: [Defect].}
|
|
else:
|
|
{.push raises: [].}
|
|
|
|
import stew/results, chronos, libp2p/peerid
|
|
import ../waku_core
|
|
|
|
const WakuLightPushCodec* = "/vac/waku/lightpush/2.0.0-beta1"
|
|
|
|
type WakuLightPushResult*[T] = Result[T, string]
|
|
|
|
type PushMessageHandler* = proc(
|
|
peer: PeerId, pubsubTopic: PubsubTopic, message: WakuMessage
|
|
): Future[WakuLightPushResult[void]] {.async.}
|
|
|
|
const TooManyRequestsMessage* = "TOO_MANY_REQUESTS"
|