policy

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

path: adresu-kit/policy/kind_filter.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGlobalDetector

func GetGlobalDetector() lingua.LanguageDetector

func NewResultFunc added in v0.1.2

func NewResultFunc(filterName string) func(allowed bool, reason string, err error) (FilterResult, error)

NewResultFunc returns a helper function for creating FilterResult objects.

Types

type EmergencyFilter

type EmergencyFilter struct {
	// contains filtered or unexported fields
}

func NewEmergencyFilter

func NewEmergencyFilter(cfg *config.EmergencyFilterConfig) (*EmergencyFilter, error)

func (*EmergencyFilter) Match

func (f *EmergencyFilter) Match(_ context.Context, ev *nostr.Event, meta map[string]any) (FilterResult, error)

type EphemeralChatFilter

type EphemeralChatFilter struct {
	// contains filtered or unexported fields
}

func (*EphemeralChatFilter) Match

func (f *EphemeralChatFilter) Match(_ context.Context, event *nostr.Event, meta map[string]any) (FilterResult, error)

type Filter added in v0.1.2

type Filter interface {
	Match(ctx context.Context, ev *nostr.Event, meta map[string]any) (FilterResult, error)
}

Filter is the interface that all kit filters must implement.

type FilterResult added in v0.1.2

type FilterResult struct {
	Allowed  bool
	Filter   string
	Reason   string
	Duration time.Duration
}

FilterResult is the structured return type for all filters.

type FreshnessFilter

type FreshnessFilter struct {
	// contains filtered or unexported fields
}

func NewFreshnessFilter

func NewFreshnessFilter(cfg *config.FreshnessFilterConfig) (*FreshnessFilter, error)

func (*FreshnessFilter) Match

func (f *FreshnessFilter) Match(_ context.Context, event *nostr.Event, meta map[string]any) (FilterResult, error)

type KeywordFilter

type KeywordFilter struct {
	// contains filtered or unexported fields
}

func NewKeywordFilter

func NewKeywordFilter(cfg *config.KeywordFilterConfig) (*KeywordFilter, error)

func (*KeywordFilter) Match

func (f *KeywordFilter) Match(_ context.Context, event *nostr.Event, meta map[string]any) (FilterResult, error)

type KindFilter

type KindFilter struct {
	// contains filtered or unexported fields
}

func NewKindFilter

func NewKindFilter(cfg *config.KindFilterConfig) (*KindFilter, error)

func (*KindFilter) Match

func (f *KindFilter) Match(_ context.Context, event *nostr.Event, meta map[string]any) (FilterResult, error)

type LanguageFilter

type LanguageFilter struct {
	// contains filtered or unexported fields
}

func (*LanguageFilter) Match

func (f *LanguageFilter) Match(_ context.Context, event *nostr.Event, meta map[string]any) (FilterResult, error)

type RateLimiterFilter

type RateLimiterFilter struct {
	// contains filtered or unexported fields
}

func NewRateLimiterFilter

func NewRateLimiterFilter(cfg *config.RateLimiterConfig) (*RateLimiterFilter, error)

func (*RateLimiterFilter) Match

func (f *RateLimiterFilter) Match(_ context.Context, event *nostr.Event, meta map[string]any) (FilterResult, error)

type RepostAbuseFilter

type RepostAbuseFilter struct {
	// contains filtered or unexported fields
}

func (*RepostAbuseFilter) Match

func (f *RepostAbuseFilter) Match(_ context.Context, event *nostr.Event, meta map[string]any) (FilterResult, error)

type SizeFilter

type SizeFilter struct {
	// contains filtered or unexported fields
}

func NewSizeFilter

func NewSizeFilter(cfg *config.SizeFilterConfig) (*SizeFilter, error)

func (*SizeFilter) Match

func (f *SizeFilter) Match(_ context.Context, event *nostr.Event, meta map[string]any) (FilterResult, error)

type TagsFilter

type TagsFilter struct {
	// contains filtered or unexported fields
}

func NewTagsFilter

func NewTagsFilter(cfg *config.TagsFilterConfig) (*TagsFilter, error)

func (*TagsFilter) Match

func (f *TagsFilter) Match(_ context.Context, event *nostr.Event, meta map[string]any) (FilterResult, error)

type UserActivityStats

type UserActivityStats struct {
	OriginalPosts int
	Reposts       int
	LastEventTime time.Time
}

Jump to

Keyboard shortcuts

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