synapse_pingora/entity/mod.rs
1//! Entity Tracking Module for Per-IP Risk Accumulation
2//!
3//! This module provides thread-safe entity tracking for synapse-pingora,
4//! enabling per-IP risk scoring, decay, and blocking decisions without
5//! requiring a roundtrip to the Node.js risk-server.
6//!
7//! # Phase 2 Module (Feature Migration from risk-server)
8//!
9//! ## Features
10//! - Thread-safe concurrent access via DashMap
11//! - Risk accumulation with time-based decay
12//! - LRU eviction for memory bounds (max 100K entities)
13//! - Rule match history with repeat offender multipliers
14//! - Anomaly tracking for behavioral analysis
15//!
16//! ## Feature Flags
17//! - `USE_PINGORA_ENTITIES=true`: Enable Pingora entity tracking
18//!
19//! ## Dual-Running Mode
20//! Both Pingora and risk-server track entities. Headers injected for comparison:
21//! - `X-Entity-Risk-Pingora`: Risk score from Pingora
22//! - `X-Entity-Risk-Node`: Risk score from risk-server
23//! - `X-Entity-Blocked-Pingora`: Block decision from Pingora
24//!
25//! @see apps/risk-server/src/state.ts (TypeScript reference)
26//! @see libsynapse/src/entity.rs (Rust reference)
27
28mod store;
29
30pub use store::{
31 // Decision types
32 BlockDecision,
33 // Configuration
34 EntityConfig,
35 // Manager
36 EntityManager,
37 EntityMetrics,
38 EntitySnapshot,
39 // State types
40 EntityState,
41 Ja4ReputationResult,
42 RiskApplication,
43 RuleMatchHistory,
44};