Skip to main content

ServerFlowManager

Struct ServerFlowManager 

Source
pub struct ServerFlowManager<T: IdentityType + Clone + Eq + Hash + Send + ToString, AE: AsyncExecutor> { /* private fields */ }
Expand description

Server-side flow manager that handles per-user packet encryption, decoy traffic, and socket I/O. Per-user crypto state is in the global SharedMap (accessed via ServerCryptoTool). Send and receive crypto are split into independent instances so their locks never contend. Per-user source addresses and decoy providers are local to each flow manager instance. When built with multiple sockets (SO_REUSEPORT on Linux), each socket is polled by its own drain task in the listener; the kernel distributes incoming datagrams across all sockets.

Implementations§

Source§

impl<T: IdentityType + Clone + Eq + Hash + Send + ToString + 'static, AE: AsyncExecutor + 'static> ServerFlowManager<T, AE>

Source

pub async fn register_user_binding( &self, id: T, addr: SocketAddr, latest_pn: u64, )

Insert (or replace) the path binding for a user on this flow.

Source

pub async fn register_user(self: &Arc<Self>, id: T, counter: Arc<AtomicU32>)

Register a per-user decoy provider and start its background timer. The user’s crypto state must already be in the global SharedMap.

Source

pub async fn ensure_user(self: &Arc<Self>, id: T, counter: Arc<AtomicU32>)

Lazily register the per-user decoy provider on this flow if not already present. Called from the route task when a non-handshake packet from a known session arrives on a flow that has not yet seen this user; the path binding has already been anchored by receive_raw’s first-packet branch by the time we get here.

Source

pub async fn remove_user(&self, id: &T)

Remove a user’s decoy provider and path binding from this flow manager.

Trait Implementations§

Source§

impl<T: IdentityType + Clone + Eq + Hash + Send + ToString + 'static, AE: AsyncExecutor + 'static> DecoyFlowSender for ServerFlowManager<T, AE>

Source§

fn send_decoy_packet<'a>( &'a self, packet: DynamicByteBuffer, fallthrough: bool, is_maintenance: bool, ) -> Pin<Box<dyn Future<Output = Result<(), FlowControllerError>> + Send + 'a>>

Send a generated decoy packet through the flow manager. fallthrough skips the tailer step (see FlowManager::send_packet).
Source§

impl<T: IdentityType + Clone + Eq + Hash + Send + ToString + 'static, AE: AsyncExecutor + 'static> ProbeFlowSender for ServerFlowManager<T, AE>

Source§

fn send_raw<'a>( &'a self, packet: DynamicByteBuffer, target: SocketAddr, ) -> Pin<Box<dyn Future<Output = Result<(), SocketError>> + Send + 'a>>

Send packet as raw bytes to target, bypassing all TYPHOON framing.

Auto Trait Implementations§

§

impl<T, AE> !Freeze for ServerFlowManager<T, AE>

§

impl<T, AE> !RefUnwindSafe for ServerFlowManager<T, AE>

§

impl<T, AE> !UnwindSafe for ServerFlowManager<T, AE>

§

impl<T, AE> Send for ServerFlowManager<T, AE>

§

impl<T, AE> Sync for ServerFlowManager<T, AE>

§

impl<T, AE> Unpin for ServerFlowManager<T, AE>
where T: Unpin,

§

impl<T, AE> UnsafeUnpin for ServerFlowManager<T, AE>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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