Skip to main content

NeuralResonanceModule

Struct NeuralResonanceModule 

Source
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

Source

pub fn new(config: NeuralConfig) -> Result<Self, String>

Create new neural module

Source

pub fn load_model(&mut self) -> Result<(), String>

Load model (marks as ready — no external model files needed)

Source

pub fn register_mask(&mut self, mask: &MaskProfile) -> Result<(), String>

Register mask — bakes its signature into a dedicated MLP encoder

Source

pub fn record_traffic( &self, session_id: [u8; 16], packet_size: u16, iat_ms: f64, entropy: f64, )

Record traffic sample for session

Source

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.

Source

pub fn record_telemetry(&mut self, mask_id: &str, packet_loss: f64, rtt_ms: f64)

Record telemetry for anomaly detection

Source

pub fn is_mask_anomalous(&self, mask_id: &str) -> bool

Check if mask is anomalous (possible DPI blocking)

Source

pub fn get_or_create_stats(&self, session_id: [u8; 16]) -> TrafficStats

Get or create session stats

Source

pub fn cleanup_stats(&self, session_id: [u8; 16])

Cleanup old session stats

Source

pub fn total_memory_bytes(&self) -> usize

Total memory usage for all baked encoders

Source

pub fn encoder_count(&self) -> usize

Number of registered mask encoders

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more