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>
impl<T: IdentityType + Clone + Eq + Hash + Send + ToString + 'static, AE: AsyncExecutor + 'static> ServerFlowManager<T, AE>
Sourcepub async fn register_user_binding(
&self,
id: T,
addr: SocketAddr,
latest_pn: u64,
)
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.
Sourcepub async fn register_user(self: &Arc<Self>, id: T, counter: Arc<AtomicU32>)
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.
Sourcepub async fn ensure_user(self: &Arc<Self>, id: T, counter: Arc<AtomicU32>)
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.
Sourcepub async fn remove_user(&self, id: &T)
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>
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>>
fn send_decoy_packet<'a>( &'a self, packet: DynamicByteBuffer, fallthrough: bool, is_maintenance: bool, ) -> Pin<Box<dyn Future<Output = Result<(), FlowControllerError>> + Send + 'a>>
fallthrough skips the tailer step (see FlowManager::send_packet).