pub struct NeuralResonanceModule { /* private fields */ }Expand description
Neural Resonance Module
Uses Baked Mask Encoders instead of an external LLM. Each mask’s signature_vector is baked into a tiny MLP (~66KB). Total memory: O(num_masks * 66KB) — fits any VPS.
Implementations§
Source§impl NeuralResonanceModule
impl NeuralResonanceModule
Sourcepub fn new(config: NeuralConfig) -> Result<Self, String>
pub fn new(config: NeuralConfig) -> Result<Self, String>
Create new neural module
Sourcepub fn load_model(&mut self) -> Result<(), String>
pub fn load_model(&mut self) -> Result<(), String>
Load model (marks as ready — no external model files needed)
Sourcepub fn register_mask(&mut self, mask: &MaskProfile) -> Result<(), String>
pub fn register_mask(&mut self, mask: &MaskProfile) -> Result<(), String>
Register mask — bakes its signature into a dedicated MLP encoder
Sourcepub fn record_traffic(
&self,
session_id: [u8; 16],
packet_size: u16,
iat_ms: f64,
entropy: f64,
)
pub fn record_traffic( &self, session_id: [u8; 16], packet_size: u16, iat_ms: f64, entropy: f64, )
Record traffic sample for session
Sourcepub fn check_resonance(
&self,
session_id: [u8; 16],
mask_id: &str,
) -> Result<ResonanceResult, String>
pub fn check_resonance( &self, session_id: [u8; 16], mask_id: &str, ) -> Result<ResonanceResult, String>
Perform resonance check (Patent 1: Signal Reconstruction Resonance)
Encodes live traffic into a 64-dim feature vector, passes it through the mask’s baked encoder, and computes reconstruction MSE.
Sourcepub fn record_telemetry(&mut self, mask_id: &str, packet_loss: f64, rtt_ms: f64)
pub fn record_telemetry(&mut self, mask_id: &str, packet_loss: f64, rtt_ms: f64)
Record telemetry for anomaly detection
Sourcepub fn is_mask_anomalous(&self, mask_id: &str) -> bool
pub fn is_mask_anomalous(&self, mask_id: &str) -> bool
Check if mask is anomalous (possible DPI blocking)
Sourcepub fn get_or_create_stats(&self, session_id: [u8; 16]) -> TrafficStats
pub fn get_or_create_stats(&self, session_id: [u8; 16]) -> TrafficStats
Get or create session stats
Sourcepub fn cleanup_stats(&self, session_id: [u8; 16])
pub fn cleanup_stats(&self, session_id: [u8; 16])
Cleanup old session stats
Sourcepub fn total_memory_bytes(&self) -> usize
pub fn total_memory_bytes(&self) -> usize
Total memory usage for all baked encoders
Sourcepub fn encoder_count(&self) -> usize
pub fn encoder_count(&self) -> usize
Number of registered mask encoders