pub struct SessionManager { /* private fields */ }
Expand description
Session manager for handling relay connections
Implementations§
Source§impl SessionManager
impl SessionManager
Sourcepub fn new(config: SessionConfig) -> (Self, UnboundedReceiver<SessionEvent>)
pub fn new(config: SessionConfig) -> (Self, UnboundedReceiver<SessionEvent>)
Create a new session manager
Sourcepub fn add_trusted_key(&self, addr: SocketAddr, key: VerifyingKey)
pub fn add_trusted_key(&self, addr: SocketAddr, key: VerifyingKey)
Add a trusted peer key for authentication
Sourcepub fn remove_trusted_key(&self, addr: &SocketAddr)
pub fn remove_trusted_key(&self, addr: &SocketAddr)
Remove a trusted peer key
Sourcepub fn request_session(
&self,
client_addr: SocketAddr,
peer_connection_id: Vec<u8>,
auth_token: AuthToken,
) -> RelayResult<SessionId>
pub fn request_session( &self, client_addr: SocketAddr, peer_connection_id: Vec<u8>, auth_token: AuthToken, ) -> RelayResult<SessionId>
Request a new relay session
Sourcepub fn establish_session(&self, session_id: SessionId) -> RelayResult<()>
pub fn establish_session(&self, session_id: SessionId) -> RelayResult<()>
Establish a relay session
Sourcepub fn terminate_session(
&self,
session_id: SessionId,
reason: String,
) -> RelayResult<()>
pub fn terminate_session( &self, session_id: SessionId, reason: String, ) -> RelayResult<()>
Terminate a relay session
Sourcepub fn forward_data(
&self,
session_id: SessionId,
data: Vec<u8>,
direction: ForwardDirection,
) -> RelayResult<()>
pub fn forward_data( &self, session_id: SessionId, data: Vec<u8>, direction: ForwardDirection, ) -> RelayResult<()>
Forward data through a relay session
Sourcepub fn get_session(&self, session_id: SessionId) -> Option<RelaySessionInfo>
pub fn get_session(&self, session_id: SessionId) -> Option<RelaySessionInfo>
Get session information
Sourcepub fn list_sessions(&self) -> Vec<RelaySessionInfo>
pub fn list_sessions(&self) -> Vec<RelaySessionInfo>
List all active sessions
Sourcepub fn session_count(&self) -> usize
pub fn session_count(&self) -> usize
Get session count
Sourcepub fn cleanup_expired_sessions(&self) -> RelayResult<usize>
pub fn cleanup_expired_sessions(&self) -> RelayResult<usize>
Clean up expired sessions
Sourcepub fn get_statistics(&self) -> SessionManagerStats
pub fn get_statistics(&self) -> SessionManagerStats
Get session manager statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SessionManager
impl RefUnwindSafe for SessionManager
impl Send for SessionManager
impl Sync for SessionManager
impl Unpin for SessionManager
impl UnwindSafe for SessionManager
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
Mutably borrows from an owned value. Read more