pub struct RitaBeaconDetector<K>{ /* private fields */ }Expand description
Per-key RITA-style robust beacon detector.
Implementations§
Source§impl<K> RitaBeaconDetector<K>
impl<K> RitaBeaconDetector<K>
Sourcepub fn new() -> Self
pub fn new() -> Self
Default tuning: window=20, interval ∈ [10 s, 24 h],
duration bonus saturates at 30 min — RITA’s standard
thresholds, matching BeaconDetector.
pub fn with_window(self, window: usize) -> Self
pub fn with_interval_range(self, min: Duration, max: Duration) -> Self
Sourcepub fn with_anomaly_threshold(self, threshold: f64) -> Self
pub fn with_anomaly_threshold(self, threshold: f64) -> Self
Composite-score floor for Self::observe_gated emission
(default 0.7). Issue #131.
Sourcepub fn with_cooldown(self, cooldown: Duration) -> Self
pub fn with_cooldown(self, cooldown: Duration) -> Self
Per-key re-emission cooldown for Self::observe_gated
(default 300 s). Issue #131.
Sourcepub fn observe(
&mut self,
key: K,
ts: Timestamp,
bytes: u64,
) -> Option<RitaBeaconScore<K>>
pub fn observe( &mut self, key: K, ts: Timestamp, bytes: u64, ) -> Option<RitaBeaconScore<K>>
Record one observation for key. Returns Some once the
window holds ≥ 10 samples and the mean interval is in range.
Sourcepub fn observe_gated(
&mut self,
key: K,
ts: Timestamp,
bytes: u64,
) -> Option<RitaBeaconScore<K>>
pub fn observe_gated( &mut self, key: K, ts: Timestamp, bytes: u64, ) -> Option<RitaBeaconScore<K>>
Self::observe plus the emission policy: Some only at
or above the anomaly threshold with the per-key cooldown
elapsed. The gate the Detector
registry impl uses (issue #131).
Sourcepub fn evict_stale(&mut self, now: Timestamp, ttl: Duration)
pub fn evict_stale(&mut self, now: Timestamp, ttl: Duration)
Drop keys whose newest sample is older than ttl before
now — bounds memory across key churn (issue #131).
Trait Implementations§
Source§impl<K> Default for RitaBeaconDetector<K>
impl<K> Default for RitaBeaconDetector<K>
Source§impl<K: KeyFields + Send> Detector<K> for RitaBeaconDetector<HostPair>
Available on crate feature tracker only.
impl<K: KeyFields + Send> Detector<K> for RitaBeaconDetector<HostPair>
tracker only.Source§fn on_flow_end(
&mut self,
key: &K,
stats: &FlowStats,
_history: &HistoryString,
_l4: Option<L4Proto>,
ts: Timestamp,
out: &mut Vec<OwnedAnomaly>,
)
fn on_flow_end( &mut self, key: &K, stats: &FlowStats, _history: &HistoryString, _l4: Option<L4Proto>, ts: Timestamp, out: &mut Vec<OwnedAnomaly>, )
Same feed as the CV impl — see
BeaconDetector’s on_flow_end docs.
Source§fn kind(&self) -> DetectorKind
fn kind(&self) -> DetectorKind
Source§fn evict_expired(&mut self, now: Timestamp)
fn evict_expired(&mut self, now: Timestamp)
now — bounds
memory across key churn.Source§fn on_flow_start(
&mut self,
_key: &K,
_ts: Timestamp,
_out: &mut Vec<OwnedAnomaly>,
)
fn on_flow_start( &mut self, _key: &K, _ts: Timestamp, _out: &mut Vec<OwnedAnomaly>, )
FlowEvent::Started).Source§fn on_flow_established(
&mut self,
_key: &K,
_ts: Timestamp,
_out: &mut Vec<OwnedAnomaly>,
)
fn on_flow_established( &mut self, _key: &K, _ts: Timestamp, _out: &mut Vec<OwnedAnomaly>, )
FlowEvent::Established).Source§fn on_flow_tick(
&mut self,
_key: &K,
_stats: &FlowStats,
_ts: Timestamp,
_out: &mut Vec<OwnedAnomaly>,
)
fn on_flow_tick( &mut self, _key: &K, _stats: &FlowStats, _ts: Timestamp, _out: &mut Vec<OwnedAnomaly>, )
FlowEvent::Tick — only
fires when FlowTrackerConfig::flow_tick_interval is
set). Note tick stats are cumulative; delta-track
inside the detector if you need per-interval values.Source§fn on_dns_query(
&mut self,
_key: &K,
_qname: &str,
_ts: Timestamp,
_out: &mut Vec<OwnedAnomaly>,
)
fn on_dns_query( &mut self, _key: &K, _qname: &str, _ts: Timestamp, _out: &mut Vec<OwnedAnomaly>, )
key. Pre-extracted
&str (e.g. from a DnsMessage::Query’s first question)
— feed it via DetectorRegistry::observe_dns from your
DNS slot drain, resolver log, or any other name source.