T5.7.1: Unify Verdict enum into wzp_relay::verdict, drop RepeatAbusive variant
This commit is contained in:
@@ -9,6 +9,8 @@ use std::time::{Duration, Instant};
|
||||
|
||||
use wzp_proto::{CodecId, MediaHeader, MediaType};
|
||||
|
||||
use crate::verdict::Verdict;
|
||||
|
||||
/// Maximum samples kept in rolling windows.
|
||||
const MAX_IAT_SAMPLES: usize = 200;
|
||||
const MAX_SIZE_SAMPLES: usize = 200;
|
||||
@@ -23,17 +25,6 @@ const BITRATE_WINDOW_SECS: u64 = 30;
|
||||
// Number of payload-size histogram bins.
|
||||
// (SIZE_BINS reserved for future histogram-based bimodality)
|
||||
|
||||
/// Verdict produced by the scorer after sufficient observation.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum Verdict {
|
||||
/// No suspicion. Score ≥ 0.7.
|
||||
Legitimate,
|
||||
/// Tightened monitoring. 0.3 ≤ score < 0.7.
|
||||
Suspect,
|
||||
/// High confidence of abuse. Score < 0.3.
|
||||
Abusive,
|
||||
}
|
||||
|
||||
/// Audio-specific behavioural scorer (Tier F).
|
||||
pub struct AudioScorer {
|
||||
/// Rolling inter-arrival times.
|
||||
|
||||
@@ -26,6 +26,7 @@ pub mod route;
|
||||
pub mod session_mgr;
|
||||
pub mod signal_hub;
|
||||
pub mod trunk;
|
||||
pub mod verdict;
|
||||
pub mod ws;
|
||||
|
||||
pub use config::RelayConfig;
|
||||
|
||||
@@ -11,18 +11,7 @@ use std::time::{Duration, Instant};
|
||||
|
||||
use wzp_proto::packet::{HangupReason, ViolationCode};
|
||||
|
||||
/// Conformance verdict produced by Tier F scoring.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum Verdict {
|
||||
/// No suspicion.
|
||||
Legitimate,
|
||||
/// Tightened monitoring.
|
||||
Suspect,
|
||||
/// High confidence of abuse — close session.
|
||||
Abusive,
|
||||
/// Already abusive once in the last 24 h — escalate to block.
|
||||
RepeatAbusive,
|
||||
}
|
||||
use crate::verdict::Verdict;
|
||||
|
||||
/// Enforcement action recommended by the response policy.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
@@ -84,7 +73,6 @@ impl ResponsePolicy {
|
||||
}
|
||||
}
|
||||
}
|
||||
Verdict::RepeatAbusive => Action::Block,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
12
crates/wzp-relay/src/verdict.rs
Normal file
12
crates/wzp-relay/src/verdict.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
//! Shared conformance verdict enum (Tier F / Tier G).
|
||||
|
||||
/// Verdict produced by Tier F scoring and consumed by Tier G response policy.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum Verdict {
|
||||
/// No suspicion. Score ≥ 0.7.
|
||||
Legitimate,
|
||||
/// Tightened monitoring. 0.3 ≤ score < 0.7.
|
||||
Suspect,
|
||||
/// High confidence of abuse. Score < 0.3.
|
||||
Abusive,
|
||||
}
|
||||
Reference in New Issue
Block a user