pub struct SrxNode { /* private fields */ }Expand description
High-level SRX protocol node (client or server).
Holds the active SrxPipeline and exposes simple send / recv_from methods.
Implementations§
Source§impl SrxNode
impl SrxNode
Sourcepub fn client_connect<F>(
config: SrxConfig,
transport_mgr: TransportManager,
exchange: F,
) -> Result<Self>
pub fn client_connect<F>( config: SrxConfig, transport_mgr: TransportManager, exchange: F, ) -> Result<Self>
Perform a client-side handshake and build the pipeline.
exchange is a closure that carries the three handshake messages over the
network (transport-agnostic so the caller can use any channel).
exchange(ClientHello) → ServerHello
exchange(ClientFinished) → ()Sourcepub fn from_master_secret(
config: SrxConfig,
master: [u8; 32],
transport_mgr: TransportManager,
) -> Result<Self>
pub fn from_master_secret( config: SrxConfig, master: [u8; 32], transport_mgr: TransportManager, ) -> Result<Self>
Build a node directly from a shared master secret (e.g. after an external handshake or for testing).
Sourcepub fn from_session(
config: SrxConfig,
session: Session,
aead: Arc<AeadPipeline>,
transport_mgr: TransportManager,
) -> Result<Self>
pub fn from_session( config: SrxConfig, session: Session, aead: Arc<AeadPipeline>, transport_mgr: TransportManager, ) -> Result<Self>
Build a node from a pre-established Session and AeadPipeline.
Sourcepub async fn send(&mut self, payload: &[u8]) -> Result<TransportKind>
pub async fn send(&mut self, payload: &[u8]) -> Result<TransportKind>
Send application payload through the full protocol stack.
Sourcepub async fn recv_from(&mut self, kind: TransportKind) -> Result<Vec<u8>>
pub async fn recv_from(&mut self, kind: TransportKind) -> Result<Vec<u8>>
Receive and decrypt from a specific transport.
Sourcepub fn process_incoming(&self, envelope: &[u8]) -> Result<Vec<u8>>
pub fn process_incoming(&self, envelope: &[u8]) -> Result<Vec<u8>>
Process raw bytes received externally (e.g. from a worker queue).
Sourcepub fn prepare_outgoing(&mut self, payload: &[u8]) -> Result<Vec<u8>>
pub fn prepare_outgoing(&mut self, payload: &[u8]) -> Result<Vec<u8>>
Prepare outgoing bytes without dispatching (for custom transport handling).
Sourcepub fn pipeline(&self) -> &SrxPipeline
pub fn pipeline(&self) -> &SrxPipeline
Access the underlying pipeline.
Sourcepub fn pipeline_mut(&mut self) -> &mut SrxPipeline
pub fn pipeline_mut(&mut self) -> &mut SrxPipeline
Mutable access to the underlying pipeline.
Sourcepub fn replay_state(&self) -> ReplayState
pub fn replay_state(&self) -> ReplayState
Snapshot anti-replay state so it can be restored after a restart.
Sourcepub fn set_replay_state(&self, state: &ReplayState) -> Result<()>
pub fn set_replay_state(&self, state: &ReplayState) -> Result<()>
Restore anti-replay state captured from a previous process instance.
Sourcepub fn send_signal(&mut self, signal: &Signal) -> Result<Vec<u8>>
pub fn send_signal(&mut self, signal: &Signal) -> Result<Vec<u8>>
Send a control signal through the full pipeline (encrypted, framed, mimicry-wrapped — indistinguishable from data on the wire).
Sourcepub fn process_incoming_dispatched(&self, envelope: &[u8]) -> Result<Payload>
pub fn process_incoming_dispatched(&self, envelope: &[u8]) -> Result<Payload>
Process raw bytes and dispatch into Payload::Data or Payload::Signal.
Sourcepub fn heal_if_needed(&mut self) -> Option<Vec<TransportKind>>
pub fn heal_if_needed(&mut self) -> Option<Vec<TransportKind>>
Check if self-healing should trigger and, if so, reseed and return a new transport order.
Returns Some(order) when healing was performed, None otherwise.
Sourcepub fn record_success(&mut self)
pub fn record_success(&mut self)
Notify the self-healing controller that traffic succeeded.
Sourcepub fn heal_count(&self) -> u32
pub fn heal_count(&self) -> u32
Number of self-healing events triggered so far.
Sourcepub fn set_environment(&mut self, env: NetworkEnvironment)
pub fn set_environment(&mut self, env: NetworkEnvironment)
Set the network environment for transport policy.
Sourcepub fn policy(&self) -> &TransportPolicy
pub fn policy(&self) -> &TransportPolicy
Access the transport policy.
Sourcepub fn replay_store_metrics() -> ReplayStoreMetricsSnapshot
pub fn replay_store_metrics() -> ReplayStoreMetricsSnapshot
Snapshot CAS contention metrics for replay-store persistence.
Auto Trait Implementations§
impl !Freeze for SrxNode
impl !RefUnwindSafe for SrxNode
impl Send for SrxNode
impl Sync for SrxNode
impl Unpin for SrxNode
impl UnsafeUnpin for SrxNode
impl !UnwindSafe for SrxNode
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> 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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request