Commit Graph
4 Commits
Author SHA1 Message Date
Wez Furlong 3839b58d94 bounce classifier: make match order more predictable
Previously, the use of BTreeMap for the rules resulted in the overall
rule order being changed in a surprising way; the key order of the map
set the overall order by category and then by the order that the rules
appeared in the file.

This commit uses an OrderMap to preserve the ordering of the keys
in the TOML (or JSON) file so that they match the order in which
they appear in the file, rather than having them become implicit
sorted by key.

Secondly, it removes the use of BTreeMap in the overall classifier
state, so that the all of the patterns are presented in the order
in which they appeared in the sequence of files loaded in the classifier
setup.

A unit test has been added to assert that matching of ambiguous (in this
case, identical) patterns takes its precedence from the order that the
patterns appear in the file.
2024-08-06 20:50:59 -07:00
Wez Furlong ec937b52ef Allow using arbitrary bounce classification labels
refs: https://github.com/KumoCorp/kumomta/issues/98
2023-11-29 12:09:05 -07:00
Wez Furlong d5b13a263b Add kumo.configure_bounce_classifier
and connect it to the logger
2023-03-02 08:59:03 -07:00
Wez Furlong 74635be9fb Add extensible bounce classifier
The classifier can load and merge rules from multiple files.
A basic iana enhanced status codes ruleset is provided.
A deployment can define their own to augment that set.

This commit is just the core classifier functionality; it
is not yet connected to kumod.

The classification enum is a bit of an amalgam of categories
defined by other well-known vendors/products and the categories
defined by IANA.  Some classifications have no corresponding
rules at the current time.
2023-03-02 08:27:32 -07:00