filter

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package filter evaluates a destination agent's inbound filter ladder against an envelope. Within a layer, rules compose as OR. Across layers, precedence is: direct address > deny > allow > classify.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Match

func Match(r Rule, e envelope.Envelope) bool

Match reports whether a single rule matches an envelope. A malformed regex or unknown match kind never matches (fail closed, no panic).

Types

type Outcome

type Outcome int

Outcome is the result of evaluating the filter ladder.

const (
	Deliver  Outcome = iota // deliver to this agent's inbox
	Drop                    // explicitly muted
	Classify                // no deterministic decision; defer to classification
)

func Decide

func Decide(e envelope.Envelope, self string, rules []Rule) Outcome

Decide runs the precedence ladder for destination agent `self`.

func (Outcome) String

func (o Outcome) String() string

type Rule

type Rule struct {
	ID     string `json:"id"`
	Action string `json:"action"` // "allow" | "deny"
	Match  string `json:"match"`  // "sender" | "topic" | "regex"
	Value  string `json:"value"`
}

Rule is one allow/deny filter rule.

Jump to

Keyboard shortcuts

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