blocklist

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package blocklist implements pattern validation and matching for the digipeater's source-address deny list. The patterns mirror the igate filter's CALL / CALL-N / CALL-* convention but the matcher is scoped strictly to the digipeater engine — see docs/wiki/invariants.md for the no-sharing rule.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidatePattern

func ValidatePattern(s string) (string, error)

ValidatePattern parses and canonicalizes a block-list pattern. On success it returns the trimmed, uppercase canonical form so the stored Pattern and the matcher input agree byte-for-byte.

Accepted forms:

CALL       — bare callsign (1..6 alphanumerics), matches SSID 0
CALL-N     — N in 0..15
CALL-*     — any non-zero SSID

Rejected: empty/whitespace, "*", "-", "-*", missing call, oversized call, wildcard inside the callsign, SSID out of range, non-numeric SSID, any character AX.25 disallows in a callsign.

Types

type Entry

type Entry struct {
	Pattern string
	Reason  string
}

Entry is one decoded, canonical block-list pattern plus its operator- supplied reason. Pattern is the canonical form returned by ValidatePattern (uppercase, trimmed).

type List

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

List is a thread-safe collection of block-list entries. The matcher is a linear scan; block lists are tiny in practice (single-digit to low-double-digit entries) so an index would only add complexity.

func New

func New(entries []Entry) *List

New returns a List seeded with the given entries. Nil or empty means "no block list" — Matches always returns hit=false.

func (*List) Matches

func (l *List) Matches(src ax25.Address) (Entry, bool)

Matches reports whether src is on the block list. On a hit it returns the matching entry so the caller can log which pattern (and reason) fired. First match wins.

func (*List) Set

func (l *List) Set(entries []Entry)

Set atomically replaces the entries. Safe for live reconfig.

Jump to

Keyboard shortcuts

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