pub struct IcmpBackoff {
pub blocked_total: Arc<AtomicU64>,
/* private fields */
}Expand description
ICMP-unreachable backoff table. Same shape as Slash24Backoff so
the TX hot path can consult both with identical cost.
Fields§
§blocked_total: Arc<AtomicU64>Total /24s currently in active backoff at any tick. Useful as a scan-level health metric.
Implementations§
Source§impl IcmpBackoff
impl IcmpBackoff
Sourcepub fn slash24_of(ip: Ipv4Addr) -> u32
pub fn slash24_of(ip: Ipv4Addr) -> u32
Convert an IPv4 address to the /24 key used by this table.
Sourcepub fn feed(&self, slash24: u32, count: u32, cfg: IcmpBackoffConfig) -> bool
pub fn feed(&self, slash24: u32, count: u32, cfg: IcmpBackoffConfig) -> bool
Feed count ICMP-unreachable observations for slash24.
Returns true if the /24 is now (or was already) in backoff.
Sourcepub fn feed_at(
&self,
slash24: u32,
count: u32,
cfg: IcmpBackoffConfig,
now: Instant,
) -> bool
pub fn feed_at( &self, slash24: u32, count: u32, cfg: IcmpBackoffConfig, now: Instant, ) -> bool
Test-friendly variant — explicit now so we can simulate time.
Sourcepub fn is_blocked(&self, slash24: u32) -> bool
pub fn is_blocked(&self, slash24: u32) -> bool
Read-only check for the TX hot path. Lock-light: returns false on any contention rather than blocking.
Sourcepub fn is_blocked_at(&self, slash24: u32, now: Instant) -> bool
pub fn is_blocked_at(&self, slash24: u32, now: Instant) -> bool
Test-friendly check — explicit now.
Sourcepub fn prune(&self, cfg: IcmpBackoffConfig)
pub fn prune(&self, cfg: IcmpBackoffConfig)
Drop entries that are out of window AND not currently blocked. Call from a 1Hz prune thread; cheap when the map is small.
Trait Implementations§
Source§impl Clone for IcmpBackoff
impl Clone for IcmpBackoff
Source§fn clone(&self) -> IcmpBackoff
fn clone(&self) -> IcmpBackoff
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for IcmpBackoff
impl Default for IcmpBackoff
Source§fn default() -> IcmpBackoff
fn default() -> IcmpBackoff
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for IcmpBackoff
impl RefUnwindSafe for IcmpBackoff
impl Send for IcmpBackoff
impl Sync for IcmpBackoff
impl Unpin for IcmpBackoff
impl UnsafeUnpin for IcmpBackoff
impl UnwindSafe for IcmpBackoff
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
Mutably borrows from an owned value. Read more