Documentation
¶
Index ¶
- Constants
- func UnsafeSigningKeys() []ed25519.PublicKey
- type CanBeInstanced
- type DensityFilter
- type EventInput
- type EventTypeFilter
- type HellbanPostfilter
- type HellbanPrefilter
- type Instanced
- type InstancedAIExecutorFilter
- type InstancedDensityFilter
- type InstancedEventFilter
- type InstancedEventTypeFilter
- type InstancedHellbanFilter
- type InstancedKeywordFilter
- type InstancedKeywordTemplateFilter
- func (f *InstancedKeywordTemplateFilter) CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
- func (f *InstancedKeywordTemplateFilter) CheckText(ctx context.Context, text string) ([]classification.Classification, error)
- func (f *InstancedKeywordTemplateFilter) Name() string
- type InstancedLengthFilter
- type InstancedLinkFilter
- type InstancedManyAtsFilter
- type InstancedMediaFilter
- type InstancedMediaScanningFilter
- type InstancedMentionsFilter
- type InstancedMjolnirFilter
- type InstancedSenderFilter
- type InstancedStickyEventsFilter
- type InstancedTextFilter
- type InstancedTrimLengthFilter
- type InstancedUnsafeSigningKeyFilter
- type InstancedUntrustedMediaFilter
- type KeywordFilter
- type KeywordTemplateFilter
- type LengthFilter
- type LinkFilter
- type ManyAtsFilter
- type MediaFilter
- type MediaScanningFilter
- type MentionsFilter
- type MjolnirFilter
- type OpenAIOmniFilter
- type SenderFilter
- type Set
- func (s *Set) CheckEvent(ctx context.Context, event gomatrixserverlib.PDU, ...) (confidence.Vectors, error)
- func (s *Set) CheckText(ctx context.Context, text string) (confidence.Vectors, error)
- func (s *Set) Close() error
- func (s *Set) GetStorage() storage.PersistentStorage
- func (s *Set) IsSpamResponse(ctx context.Context, vecs confidence.Vectors) bool
- type SetConfig
- type SetGroupConfig
- type StickyEventsFilter
- type TrimLengthFilter
- type UnsafeSigningKeyFilter
- type UntrustedMediaFilter
Constants ¶
const DensityFilterName = "DensityFilter"
const EventTypeFilterName = "EventTypeFilter"
const HellbanPostfilterName = "HellbanPostfilter"
const HellbanPrefilterName = "HellbanPrefilter"
const KeywordFilterName = "KeywordFilter"
const KeywordTemplateFilterName = "KeywordTemplateFilter"
const LengthFilterName = "LengthFilter"
const LinkFilterName = "LinkFilter"
const ManyAtsFilterName = "ManyAtsFilter"
const MediaFilterName = "MediaFilter"
const MediaScanningFilterName = "MediaScanningFilter"
const MentionsFilterName = "MentionsFilter"
const MjolnirFilterName = "MjolnirFilter"
const OpenAIOmniFilterName = "OpenAIOmniFilter"
const SenderFilterName = "SenderFilter"
const StickyEventsFilterName = "StickyEventsFilter"
const TrimLengthFilterName = "TrimLengthFilter"
const UnsafeSigningKeyFilterName = "UnsafeSigningKeyFilter"
const UntrustedMediaFilterName = "UntrustedMediaFilter"
Variables ¶
This section is empty.
Functions ¶
func UnsafeSigningKeys ¶ added in v1.2.0
Types ¶
type CanBeInstanced ¶
type CanBeInstanced interface {
// MakeFor - Creates a long-lived Instanced for the provided Set. If an error occurred, the Instanced will
// be nil.
MakeFor(set *Set) (Instanced, error)
}
CanBeInstanced - The base filter type, registered at compile/run time and used by Sets to create a long-lived Instanced instance.
type DensityFilter ¶
type DensityFilter struct {
}
type EventInput ¶ added in v1.2.0
type EventInput struct {
// The event to process/check.
Event gomatrixserverlib.PDU
// The confidence.Vectors so far. Note that the first set group will receive a classification.Spam vector of 0.5
IncrementalConfidenceVectors confidence.Vectors
// Extracted media items from the event.
Medias []*media.Item
// contains filtered or unexported fields
}
EventInput - An event with context to be provided to an InstancedEventFilter.
type EventTypeFilter ¶
type EventTypeFilter struct {
}
type HellbanPostfilter ¶
type HellbanPostfilter struct {
}
type HellbanPrefilter ¶
type HellbanPrefilter struct {
}
type Instanced ¶
type Instanced interface {
// Name - The name of the filter for logging and metrics.
Name() string
}
Instanced - A Set-specific filter.
type InstancedAIExecutorFilter ¶ added in v1.1.0
type InstancedAIExecutorFilter[ConfigT any] struct { // contains filtered or unexported fields }
func NewInstancedAIExecutorFilter ¶ added in v1.1.0
func (*InstancedAIExecutorFilter[ConfigT]) CheckEvent ¶ added in v1.1.0
func (f *InstancedAIExecutorFilter[ConfigT]) CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
func (*InstancedAIExecutorFilter[ConfigT]) Name ¶ added in v1.1.0
func (f *InstancedAIExecutorFilter[ConfigT]) Name() string
type InstancedDensityFilter ¶
type InstancedDensityFilter struct {
// contains filtered or unexported fields
}
func (*InstancedDensityFilter) CheckEvent ¶
func (f *InstancedDensityFilter) CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
func (*InstancedDensityFilter) CheckText ¶ added in v1.2.0
func (f *InstancedDensityFilter) CheckText(ctx context.Context, text string) ([]classification.Classification, error)
func (*InstancedDensityFilter) Name ¶
func (f *InstancedDensityFilter) Name() string
type InstancedEventFilter ¶ added in v1.2.0
type InstancedEventFilter interface {
Instanced // parent type
// CheckEvent - Processes the given event, returning classifications about it. If an error occurred, the classifications
// array will be nil/empty.
CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
}
InstancedEventFilter - A filter which processes events.
type InstancedEventTypeFilter ¶
type InstancedEventTypeFilter struct {
// contains filtered or unexported fields
}
func (*InstancedEventTypeFilter) CheckEvent ¶
func (f *InstancedEventTypeFilter) CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
func (*InstancedEventTypeFilter) Name ¶
func (f *InstancedEventTypeFilter) Name() string
type InstancedHellbanFilter ¶
type InstancedHellbanFilter struct {
// contains filtered or unexported fields
}
func (*InstancedHellbanFilter) CheckEvent ¶
func (f *InstancedHellbanFilter) CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
func (*InstancedHellbanFilter) Close ¶
func (f *InstancedHellbanFilter) Close() error
func (*InstancedHellbanFilter) Name ¶
func (f *InstancedHellbanFilter) Name() string
type InstancedKeywordFilter ¶
type InstancedKeywordFilter struct {
// contains filtered or unexported fields
}
func (*InstancedKeywordFilter) CheckEvent ¶
func (f *InstancedKeywordFilter) CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
func (*InstancedKeywordFilter) CheckText ¶ added in v1.2.0
func (f *InstancedKeywordFilter) CheckText(ctx context.Context, text string) ([]classification.Classification, error)
func (*InstancedKeywordFilter) Name ¶
func (f *InstancedKeywordFilter) Name() string
type InstancedKeywordTemplateFilter ¶ added in v1.1.0
type InstancedKeywordTemplateFilter struct {
// contains filtered or unexported fields
}
func (*InstancedKeywordTemplateFilter) CheckEvent ¶ added in v1.1.0
func (f *InstancedKeywordTemplateFilter) CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
func (*InstancedKeywordTemplateFilter) CheckText ¶ added in v1.2.0
func (f *InstancedKeywordTemplateFilter) CheckText(ctx context.Context, text string) ([]classification.Classification, error)
func (*InstancedKeywordTemplateFilter) Name ¶ added in v1.1.0
func (f *InstancedKeywordTemplateFilter) Name() string
type InstancedLengthFilter ¶
type InstancedLengthFilter struct {
// contains filtered or unexported fields
}
func (*InstancedLengthFilter) CheckEvent ¶
func (f *InstancedLengthFilter) CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
func (*InstancedLengthFilter) CheckText ¶ added in v1.2.0
func (f *InstancedLengthFilter) CheckText(ctx context.Context, text string) ([]classification.Classification, error)
func (*InstancedLengthFilter) Name ¶
func (f *InstancedLengthFilter) Name() string
type InstancedLinkFilter ¶ added in v1.2.0
type InstancedLinkFilter struct {
// contains filtered or unexported fields
}
func (*InstancedLinkFilter) CheckEvent ¶ added in v1.2.0
func (f *InstancedLinkFilter) CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
func (*InstancedLinkFilter) CheckText ¶ added in v1.2.0
func (f *InstancedLinkFilter) CheckText(ctx context.Context, text string) ([]classification.Classification, error)
func (*InstancedLinkFilter) Name ¶ added in v1.2.0
func (f *InstancedLinkFilter) Name() string
type InstancedManyAtsFilter ¶
type InstancedManyAtsFilter struct {
// contains filtered or unexported fields
}
func (*InstancedManyAtsFilter) CheckEvent ¶
func (f *InstancedManyAtsFilter) CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
func (*InstancedManyAtsFilter) CheckText ¶ added in v1.2.0
func (f *InstancedManyAtsFilter) CheckText(ctx context.Context, text string) ([]classification.Classification, error)
func (*InstancedManyAtsFilter) Name ¶
func (f *InstancedManyAtsFilter) Name() string
type InstancedMediaFilter ¶
type InstancedMediaFilter struct {
// contains filtered or unexported fields
}
func (*InstancedMediaFilter) CheckEvent ¶
func (f *InstancedMediaFilter) CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
func (*InstancedMediaFilter) Name ¶
func (f *InstancedMediaFilter) Name() string
type InstancedMediaScanningFilter ¶
type InstancedMediaScanningFilter struct {
// contains filtered or unexported fields
}
func (*InstancedMediaScanningFilter) CheckEvent ¶
func (f *InstancedMediaScanningFilter) CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
func (*InstancedMediaScanningFilter) Name ¶
func (f *InstancedMediaScanningFilter) Name() string
type InstancedMentionsFilter ¶
type InstancedMentionsFilter struct {
// contains filtered or unexported fields
}
func (*InstancedMentionsFilter) CheckEvent ¶
func (f *InstancedMentionsFilter) CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
func (*InstancedMentionsFilter) Name ¶
func (f *InstancedMentionsFilter) Name() string
type InstancedMjolnirFilter ¶
type InstancedMjolnirFilter struct {
// contains filtered or unexported fields
}
func (*InstancedMjolnirFilter) CheckEvent ¶
func (f *InstancedMjolnirFilter) CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
func (*InstancedMjolnirFilter) Name ¶
func (f *InstancedMjolnirFilter) Name() string
type InstancedSenderFilter ¶
type InstancedSenderFilter struct {
// contains filtered or unexported fields
}
func (*InstancedSenderFilter) CheckEvent ¶
func (f *InstancedSenderFilter) CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
func (*InstancedSenderFilter) Name ¶
func (f *InstancedSenderFilter) Name() string
type InstancedStickyEventsFilter ¶
type InstancedStickyEventsFilter struct {
// contains filtered or unexported fields
}
func (*InstancedStickyEventsFilter) CheckEvent ¶
func (f *InstancedStickyEventsFilter) CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
func (*InstancedStickyEventsFilter) Name ¶
func (f *InstancedStickyEventsFilter) Name() string
type InstancedTextFilter ¶ added in v1.2.0
type InstancedTextFilter interface {
Instanced // parent type
// CheckText - Processes the given text, returning classifications about it. If an error occurred, the classifications
// array will be nil/empty. The input text string is assumed to be user-generated (message body, search query, etc)
// rather than structured (JSON, CSV, etc).
CheckText(ctx context.Context, input string) ([]classification.Classification, error)
}
type InstancedTrimLengthFilter ¶
type InstancedTrimLengthFilter struct {
// contains filtered or unexported fields
}
func (*InstancedTrimLengthFilter) CheckEvent ¶
func (f *InstancedTrimLengthFilter) CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
func (*InstancedTrimLengthFilter) CheckText ¶ added in v1.2.0
func (f *InstancedTrimLengthFilter) CheckText(ctx context.Context, text string) ([]classification.Classification, error)
func (*InstancedTrimLengthFilter) Name ¶
func (f *InstancedTrimLengthFilter) Name() string
type InstancedUnsafeSigningKeyFilter ¶ added in v1.2.0
type InstancedUnsafeSigningKeyFilter struct {
// contains filtered or unexported fields
}
func (*InstancedUnsafeSigningKeyFilter) CheckEvent ¶ added in v1.2.0
func (f *InstancedUnsafeSigningKeyFilter) CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
func (*InstancedUnsafeSigningKeyFilter) Name ¶ added in v1.2.0
func (f *InstancedUnsafeSigningKeyFilter) Name() string
type InstancedUntrustedMediaFilter ¶
type InstancedUntrustedMediaFilter struct {
// contains filtered or unexported fields
}
func (*InstancedUntrustedMediaFilter) CheckEvent ¶
func (f *InstancedUntrustedMediaFilter) CheckEvent(ctx context.Context, input *EventInput) ([]classification.Classification, error)
func (*InstancedUntrustedMediaFilter) Name ¶
func (f *InstancedUntrustedMediaFilter) Name() string
type KeywordFilter ¶
type KeywordFilter struct {
}
type KeywordTemplateFilter ¶ added in v1.1.0
type KeywordTemplateFilter struct {
}
type LengthFilter ¶
type LengthFilter struct {
}
type LinkFilter ¶ added in v1.2.0
type LinkFilter struct{}
LinkFilter is a filter that checks for URLs in the event content. It's configured with a deny list and an allow list. Matches against the deny list win.
type ManyAtsFilter ¶
type ManyAtsFilter struct {
}
type MediaFilter ¶
type MediaFilter struct {
}
type MediaScanningFilter ¶
type MediaScanningFilter struct {
}
type MentionsFilter ¶
type MentionsFilter struct {
}
type MjolnirFilter ¶
type MjolnirFilter struct {
}
type OpenAIOmniFilter ¶ added in v1.1.0
type OpenAIOmniFilter struct {
}
type SenderFilter ¶
type SenderFilter struct {
}
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
func (*Set) CheckEvent ¶
func (s *Set) CheckEvent(ctx context.Context, event gomatrixserverlib.PDU, mediaDownloader media.Downloader) (confidence.Vectors, error)
CheckEvent - Checks an event over all of the set groups in order. If a set group errors, execution stops there. Note: the mediaDownloader may be nil to prevent parsing and downloading of media. This should only be done in test environments.
func (*Set) GetStorage ¶
func (s *Set) GetStorage() storage.PersistentStorage
GetStorage - Accessor to the underlying PersistentStorage
func (*Set) IsSpamResponse ¶
type SetConfig ¶
type SetConfig struct {
// Filters are organized into Groups for execution and processing.
Groups []*SetGroupConfig
CommunityConfig *config.CommunityConfig
InstanceConfig *config.InstanceConfig
CommunityId string
}
type SetGroupConfig ¶
type SetGroupConfig struct {
// The filter names this group enables. All filters within a group are executed concurrently.
EnabledNames []string
// The minimum vector value for classification.Spam required for this set group to process events.
// Note: The first set group will receive a classification.Spam vector value of 0.5
MinimumSpamVectorValue float64
// The maximum vector value for classification.Spam allowed for this set group to process events.
MaximumSpamVectorValue float64
}
type StickyEventsFilter ¶
type StickyEventsFilter struct {
}
type TrimLengthFilter ¶
type TrimLengthFilter struct {
}
type UnsafeSigningKeyFilter ¶ added in v1.2.0
type UnsafeSigningKeyFilter struct {
}
type UntrustedMediaFilter ¶
type UntrustedMediaFilter struct {
}
Source Files
¶
- audit.go
- filter_ai_executor.go
- filter_density.go
- filter_event_type.go
- filter_hellban.go
- filter_keyword_template.go
- filter_keywords.go
- filter_length.go
- filter_links.go
- filter_many_ats.go
- filter_media.go
- filter_media_scanning.go
- filter_mentions.go
- filter_mjolnir.go
- filter_openai_omni.go
- filter_sender.go
- filter_sticky_events.go
- filter_trim_length.go
- filter_unsafe_signing_key.go
- filter_untrusted_media.go
- registry.go
- set.go
- set_group.go
- types.go