Documentation ¶
Index ¶
- func AntiSyncBots(ctx context.Context, filter nostr.Filter) (reject bool, msg string)
- func ApplySaneDefaults(relay *khatru.Relay)
- func ConnectionRateLimiter(tokensPerInterval int, interval time.Duration, maxTokens int) func(r *http.Request) bool
- func EventIPRateLimiter(tokensPerInterval int, interval time.Duration, maxTokens int) func(ctx context.Context, _ *nostr.Event) (reject bool, msg string)
- func EventPubKeyRateLimiter(tokensPerInterval int, interval time.Duration, maxTokens int) func(ctx context.Context, _ *nostr.Event) (reject bool, msg string)
- func FilterIPRateLimiter(tokensPerInterval int, interval time.Duration, maxTokens int) func(ctx context.Context, _ nostr.Filter) (reject bool, msg string)
- func NoComplexFilters(ctx context.Context, filter nostr.Filter) (reject bool, msg string)
- func NoEmptyFilters(ctx context.Context, filter nostr.Filter) (reject bool, msg string)
- func NoSearchQueries(ctx context.Context, filter nostr.Filter) (reject bool, msg string)
- func PreventLargeTags(maxTagValueLen int) func(context.Context, *nostr.Event) (bool, string)
- func PreventTimestampsInTheFuture(threshold time.Duration) func(context.Context, *nostr.Event) (bool, string)
- func PreventTimestampsInThePast(threshold time.Duration) func(context.Context, *nostr.Event) (bool, string)
- func PreventTooManyIndexableTags(max int, ignoreKinds []int, onlyKinds []int) func(context.Context, *nostr.Event) (bool, string)
- func RejectEventsWithBase64Media(ctx context.Context, evt *nostr.Event) (bool, string)
- func RejectKind04Snoopers(ctx context.Context, filter nostr.Filter) (bool, string)
- func RemoveAllButKinds(kinds ...uint16) func(context.Context, *nostr.Filter)
- func RemoveAllButTags(tagNames ...string) func(context.Context, *nostr.Filter)
- func RemoveSearchQueries(ctx context.Context, filter *nostr.Filter)
- func RestrictToSpecifiedKinds(allowEphemeral bool, kinds ...uint16) func(context.Context, *nostr.Event) (bool, string)
- func ValidateKind(ctx context.Context, evt *nostr.Event) (bool, string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AntiSyncBots ¶
AntiSyncBots tries to prevent people from syncing kind:1s from this relay to else by always requiring an author parameter at least.
func ApplySaneDefaults ¶ added in v0.4.3
func ConnectionRateLimiter ¶ added in v0.4.3
func EventIPRateLimiter ¶ added in v0.4.3
func EventPubKeyRateLimiter ¶ added in v0.4.3
func FilterIPRateLimiter ¶ added in v0.4.3
func NoComplexFilters ¶
NoComplexFilters disallows filters with more than 2 tags.
func NoEmptyFilters ¶
NoEmptyFilters disallows filters that don't have at least a tag, a kind, an author or an id.
func NoSearchQueries ¶
func PreventLargeTags ¶
PreventLargeTags rejects events that have indexable tag values greater than maxTagValueLen.
func PreventTooManyIndexableTags ¶
func PreventTooManyIndexableTags(max int, ignoreKinds []int, onlyKinds []int) func(context.Context, *nostr.Event) (bool, string)
PreventTooManyIndexableTags returns a function that can be used as a RejectFilter that will reject events with more indexable (single-character) tags than the specified number.
If ignoreKinds is given this restriction will not apply to these kinds (useful for allowing a bigger). If onlyKinds is given then all other kinds will be ignored.
func RejectEventsWithBase64Media ¶ added in v0.4.3
func RejectKind04Snoopers ¶
RejectKind04Snoopers prevents reading NIP-04 messages from people not involved in the conversation.
func RemoveAllButKinds ¶
func RemoveAllButTags ¶
func RemoveSearchQueries ¶
func RestrictToSpecifiedKinds ¶
func RestrictToSpecifiedKinds(allowEphemeral bool, kinds ...uint16) func(context.Context, *nostr.Event) (bool, string)
RestrictToSpecifiedKinds returns a function that can be used as a RejectFilter that will reject any events with kinds different than the specified ones.
Types ¶
This section is empty.