feat: reject events that are too large

A new configuration setting controls the maximum size of event
messages, and sends a notice to the client if they exceed it.

Fixes https://todo.sr.ht/~gheartsfield/nostr-rs-relay/14
This commit is contained in:
Greg Heartsfield
2021-12-31 15:19:35 -06:00
parent 8f3891c781
commit 4171a8870e
6 changed files with 33 additions and 15 deletions
+2
View File
@@ -21,6 +21,8 @@ pub enum Error {
CloseParseFailed,
#[error("Event validation failed")]
EventInvalid,
#[error("Event too large")]
EventMaxLengthError(usize),
#[error("Subscription identifier max length exceeded")]
SubIdMaxLengthError,
#[error("Maximum concurrent subscription count reached")]