introduce and use new route framework

in this change:

* new "concurrent map" API using RwLock<HashMap> optimized for
  frequent reads.
* we no longer have a concurrent map of log handlers, we instead
  have a log handler containing a concurrent map from origins to
  circular buffers
* we have a general concept of a "Limit" now which replaces AlertRule
* A route consists of a filter, plus any number of limits, which
  can be per-origin limits or global limits
* The set of routes is disjunctive, while the filters and limits are conjunctive
* Limits can also apply per source location
* Different types of rate limiters are unified under the "Limiter"
  abstraction
* The log handler also has a set of overall limiters that can be applied
  at the end
* This means we can relatively easily express disjunctions of conjunctions

I think the route structure will also be relatively easy to express in toml
This commit is contained in:
Chris Beck
2025-12-05 19:10:37 -07:00
parent ffa1246e51
commit a214b8e474
9 changed files with 684 additions and 287 deletions
+5 -1
View File
@@ -1,3 +1,7 @@
//! Signal Gateway binary - receives alerts and logs, forwards to Signal messenger.
#![deny(missing_docs)]
use conf::{Conf, Subcommands};
use hyper::service::service_fn;
use hyper_util::rt::TokioIo;
@@ -18,7 +22,7 @@ use admin_netcat::AdminNetcatConfig;
mod syslog;
use syslog::SyslogConfig;
mod json;
pub mod json;
use json::JsonConfig;
/// Admin message handler configuration - select how non-command messages are handled