pub trait StunEndpointUser: Send + Sync {
    type Transport: TransportInfo + Send + Sync;

    // Required methods
    fn send_to<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        bytes: &'life1 [u8],
        target: SocketAddr,
        transport: &'life2 Self::Transport
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn receive<'life0, 'async_trait>(
        &'life0 self,
        message: IncomingMessage<Self::Transport>
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Defines the “user” of a StunEndpoint.

It is designed to be somewhat flexible and transport agnostic.

When using a StunEndpoint for multiple transports UserData can be used to either pass the transport around directly or have just be an identifying key.

Required Associated Types§

Required Methods§

source

fn send_to<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, bytes: &'life1 [u8], target: SocketAddr, transport: &'life2 Self::Transport ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Send the given bytes to target with the given transport.

source

fn receive<'life0, 'async_trait>( &'life0 self, message: IncomingMessage<Self::Transport> ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Called by StunEndpoint::receive when it encounters a message without a matching transaction id.

Implementors§