pub struct IpBanConfig {
pub enable_ip_banning: bool,
pub auto_ban_threshold: u32,
pub auto_ban_duration: u64,
pub threat_ban_config: HashMap<String, ThreatBanEntry>,
}Expand description
The IP-banning knobs (the reference enable_ip_banning /
auto_ban_threshold / auto_ban_duration / threat_ban_config group).
The defaults are the reference SecurityConfig defaults: banning on
(enable_ip_banning = true, guard_core/_security_config_fields.py)
with the reference threshold/duration pair.
Fields§
§enable_ip_banning: boolenable_ip_banning. false makes every ban resolution a no-op;
violations still count (the reference counts regardless so enabling
banning later starts from observed history).
auto_ban_threshold: u32auto_ban_threshold: the flat fallback, measured against the total
of all counted categories.
auto_ban_duration: u64auto_ban_duration: the flat fallback ban length (seconds).
threat_ban_config: HashMap<String, ThreatBanEntry>threat_ban_config: per-category threshold/duration overrides,
consulted before the flat pair.
Implementations§
Source§impl IpBanConfig
impl IpBanConfig
Sourcepub fn new<I, K, V>(
enable_ip_banning: bool,
auto_ban_threshold: u32,
auto_ban_duration: u64,
threat_ban_config: I,
) -> Result<Self, IpBanConfigError>
pub fn new<I, K, V>( enable_ip_banning: bool, auto_ban_threshold: u32, auto_ban_duration: u64, threat_ban_config: I, ) -> Result<Self, IpBanConfigError>
Build and validate a config, failing closed on a non-positive
threshold/duration or an unknown threat_ban_config category.
§Errors
IpBanConfigError::NonPositive for a zero auto_ban_threshold or
auto_ban_duration (the reference rejects both with ge=1),
IpBanConfigError::UnknownCategory for a key outside
valid_threat_categories.
Sourcepub fn validate(&self) -> Result<(), IpBanConfigError>
pub fn validate(&self) -> Result<(), IpBanConfigError>
Validate this config. Struct-literal builders can run the same checks the constructor applies.
§Errors
See IpBanConfig::new.
Trait Implementations§
Source§impl Clone for IpBanConfig
impl Clone for IpBanConfig
Source§impl Debug for IpBanConfig
impl Debug for IpBanConfig
Source§impl Default for IpBanConfig
impl Default for IpBanConfig
impl Eq for IpBanConfig
Source§impl PartialEq for IpBanConfig
impl PartialEq for IpBanConfig
impl StructuralPartialEq for IpBanConfig
Auto Trait Implementations§
impl Freeze for IpBanConfig
impl RefUnwindSafe for IpBanConfig
impl Send for IpBanConfig
impl Sync for IpBanConfig
impl Unpin for IpBanConfig
impl UnsafeUnpin for IpBanConfig
impl UnwindSafe for IpBanConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.