khatru: replace useless ApplySaneDefaults() with a set of pluggable "strict" defaults.

This commit is contained in:
fiatjaf
2025-08-28 17:18:22 -03:00
parent 43d6814daf
commit 7ac9e6290b
4 changed files with 44 additions and 23 deletions
+24
View File
@@ -0,0 +1,24 @@
package policies
import (
"time"
"fiatjaf.com/nostr"
)
var EventRejectionStrictDefaults = SeqEvent(
RejectEventsWithBase64Media,
PreventLargeTags(100),
PreventTooManyIndexableTags(12, []nostr.Kind{3}, nil),
PreventTooManyIndexableTags(1200, nil, []nostr.Kind{3}),
PreventLargeContent(5000),
EventIPRateLimiter(2, time.Minute*3, 10),
)
var RequestRejectionStrictDefaults = SeqRequest(
NoComplexFilters,
NoSearchQueries,
FilterIPRateLimiter(20, time.Minute, 100),
)
var ConnectionRejectionStrictDefaults = ConnectionRateLimiter(1, time.Minute*5, 100)