pub struct EntityState {Show 16 fields
pub entity_id: String,
pub site_id: Option<String>,
pub risk: f64,
pub first_seen_at: u64,
pub last_seen_at: u64,
pub last_decay_at: u64,
pub request_count: u64,
pub blocked: bool,
pub blocked_reason: Option<String>,
pub blocked_since: Option<u64>,
pub matches: HashMap<u32, RuleMatchHistory>,
pub ja4_fingerprint: Option<String>,
pub combined_fingerprint: Option<String>,
pub previous_ja4: Option<String>,
pub ja4_change_count: u32,
pub last_ja4_change_ms: Option<u64>,
}Expand description
Per-IP entity state.
Fields§
§entity_id: StringIP address (primary key).
site_id: Option<String>Site/tenant ID this entity is associated with (for multi-tenant isolation).
risk: f64Accumulated risk score (0.0-max_risk).
first_seen_at: u64First seen timestamp (ms).
last_seen_at: u64Last seen timestamp (ms).
last_decay_at: u64Last decay timestamp (ms).
request_count: u64Total request count.
blocked: boolWhether this entity is blocked.
blocked_reason: Option<String>Reason for blocking.
blocked_since: Option<u64>Timestamp when blocked (ms).
matches: HashMap<u32, RuleMatchHistory>Rule match history (rule_id -> history).
ja4_fingerprint: Option<String>JA4 fingerprint (if available).
combined_fingerprint: Option<String>Combined fingerprint hash (for correlation).
previous_ja4: Option<String>Previous JA4 fingerprint (for change detection).
ja4_change_count: u32Count of JA4 changes within the tracking window.
last_ja4_change_ms: Option<u64>Timestamp of last JA4 change (milliseconds).
Implementations§
Source§impl EntityState
impl EntityState
Sourcepub fn with_site(entity_id: String, site_id: String, now: u64) -> Self
pub fn with_site(entity_id: String, site_id: String, now: u64) -> Self
Create a new entity state with a site ID.
Sourcepub fn get_match_multiplier(&self, rule_id: u32) -> f64
pub fn get_match_multiplier(&self, rule_id: u32) -> f64
Get the repeat offender multiplier for a rule.
Returns 1.0 if rule hasn’t been matched before. Multiplier tiers: 1→1.0, 2→1.25, 6→1.5, 11→2.0
Sourcepub fn get_match_count(&self, rule_id: u32) -> u32
pub fn get_match_count(&self, rule_id: u32) -> u32
Get match count for a rule (0 if not matched).
Trait Implementations§
Source§impl Clone for EntityState
impl Clone for EntityState
Source§fn clone(&self) -> EntityState
fn clone(&self) -> EntityState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EntityState
impl Debug for EntityState
Source§impl<'de> Deserialize<'de> for EntityState
impl<'de> Deserialize<'de> for EntityState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for EntityState
impl RefUnwindSafe for EntityState
impl Send for EntityState
impl Sync for EntityState
impl Unpin for EntityState
impl UnsafeUnpin for EntityState
impl UnwindSafe for EntityState
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more