policies

package
v1.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2024 License: CC0-1.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AntiSyncBots

func AntiSyncBots(c context.T, f filter.T) (reject bool, msg string)

AntiSyncBots tries to prevent people from syncing kind:1s from this relay to else by always requiring an author parameter at least.

func NoComplexFilters

func NoComplexFilters(c context.T, f filter.T) (reject bool, msg string)

NoComplexFilters disallows filters with more than 2 tags.

func NoEmptyFilters

func NoEmptyFilters(c context.T, f filter.T) (reject bool, msg string)

NoEmptyFilters disallows filters that don't have at least a tag, a kind, an author or an id.

func NoSearchQueries

func NoSearchQueries(c context.T, f filter.T) (reject bool, msg string)

func PreventLargeTags

func PreventLargeTags(maxTagValueLen int) func(context.T, *event.T) (bool, string)

PreventLargeTags rejects events that have indexable tag values greater than maxTagValueLen.

func PreventTimestampsInTheFuture

func PreventTimestampsInTheFuture(thresholdSeconds timestamp.T) func(context.T, *event.T) (bool, string)

func PreventTimestampsInThePast

func PreventTimestampsInThePast(thresholdSeconds timestamp.T) func(context.T, *event.T) (bool, string)

func PreventTooManyIndexableTags

func PreventTooManyIndexableTags(max int, ignoreKinds kinds.T, onlyKinds kinds.T) func(context.T, *event.T) (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 RejectKind04Snoopers

func RejectKind04Snoopers(c context.T, f filter.T) (bool, string)

RejectKind04Snoopers prevents reading NIP-04 messages from people not involved in the conversation.

func RemoveAllButKinds

func RemoveAllButKinds(kinds ...uint16) func(context.T, *filter.T)

func RemoveAllButTags

func RemoveAllButTags(tagNames ...string) func(context.T, *filter.T)

func RemoveSearchQueries

func RemoveSearchQueries(c context.T, f *filter.T)

func RestrictToSpecifiedKinds

func RestrictToSpecifiedKinds(kinds ...kind.T) func(context.T, *event.T) (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.

todo: this range minimum doesn't look like it would ever change from zero

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL