pub struct Listener { /* private fields */ }
Expand description
A sosistab listener.
Implementations§
source§impl Listener
impl Listener
sourcepub async fn accept_session(&self) -> Option<Session>
pub async fn accept_session(&self) -> Option<Session>
Accepts a session. This function must be repeatedly called for the entire Listener to make any progress.
sourcepub async fn listen_udp(
addr: SocketAddr,
long_sk: StaticSecret,
on_recv: impl Fn(usize, SocketAddr) + 'static + Send + Sync,
on_send: impl Fn(usize, SocketAddr) + 'static + Send + Sync
) -> Result<Self>
pub async fn listen_udp(
addr: SocketAddr,
long_sk: StaticSecret,
on_recv: impl Fn(usize, SocketAddr) + 'static + Send + Sync,
on_send: impl Fn(usize, SocketAddr) + 'static + Send + Sync
) -> Result<Self>
Creates a new listener given the parameters.
sourcepub async fn listen_tcp(
addr: impl AsyncToSocketAddrs,
long_sk: StaticSecret,
on_recv: impl Fn(usize, SocketAddr) + 'static + Send + Sync,
on_send: impl Fn(usize, SocketAddr) + 'static + Send + Sync
) -> Result<Self>
pub async fn listen_tcp(
addr: impl AsyncToSocketAddrs,
long_sk: StaticSecret,
on_recv: impl Fn(usize, SocketAddr) + 'static + Send + Sync,
on_send: impl Fn(usize, SocketAddr) + 'static + Send + Sync
) -> Result<Self>
Creates a new listener given the parameters.
sourcepub fn listener_stats(&self) -> Arc<ListenerStats>
pub fn listener_stats(&self) -> Arc<ListenerStats>
Obtains the stats of this listener
sourcepub fn local_addr(&self) -> SocketAddr
pub fn local_addr(&self) -> SocketAddr
Gets the local address.