TurnServerApi

Trait TurnServerApi 

Source
pub trait TurnServerApi: Send + Debug {
    // Required methods
    fn add_user(&mut self, username: String, password: String);
    fn listen_address(&self) -> SocketAddr;
    fn set_nonce_expiry_duration(&mut self, expiry_duration: Duration);
    fn recv<T: AsRef<[u8]> + Debug>(
        &mut self,
        transmit: Transmit<T>,
        now: Instant,
    ) -> Option<TransmitBuild<DelayedMessageOrChannelSend<T>>>;
    fn recv_icmp<T: AsRef<[u8]>>(
        &mut self,
        family: AddressFamily,
        bytes: T,
        now: Instant,
    ) -> Option<Transmit<Vec<u8>>>;
    fn poll(&mut self, now: Instant) -> TurnServerPollRet;
    fn poll_transmit(&mut self, now: Instant) -> Option<Transmit<Vec<u8>>>;
    fn allocated_udp_socket(
        &mut self,
        transport: TransportType,
        local_addr: SocketAddr,
        remote_addr: SocketAddr,
        family: AddressFamily,
        socket_addr: Result<SocketAddr, SocketAllocateError>,
        now: Instant,
    );
}
Expand description

API for TURN servers.

Required Methods§

Source

fn add_user(&mut self, username: String, password: String)

Add a user credentials that would be accepted by this TurnServerApi.

Source

fn listen_address(&self) -> SocketAddr

The address that the TurnServerApi is listening on for incoming client connections.

Source

fn set_nonce_expiry_duration(&mut self, expiry_duration: Duration)

Set the amount of time that a Nonce (used for authentication) will expire and a new Nonce will need to be acquired by a client.

Source

fn recv<T: AsRef<[u8]> + Debug>( &mut self, transmit: Transmit<T>, now: Instant, ) -> Option<TransmitBuild<DelayedMessageOrChannelSend<T>>>

Provide received data to the TurnServerApi.

Any returned Transmit should be forwarded to the appropriate socket.

Source

fn recv_icmp<T: AsRef<[u8]>>( &mut self, family: AddressFamily, bytes: T, now: Instant, ) -> Option<Transmit<Vec<u8>>>

Provide a received ICMP packet to the TurnServerApi.

Any returned Transmit should be forwarded to the appropriate socket.

Source

fn poll(&mut self, now: Instant) -> TurnServerPollRet

Poll the TurnServerApi in order to make further progress.

The returned value indicates what the caller should do.

Source

fn poll_transmit(&mut self, now: Instant) -> Option<Transmit<Vec<u8>>>

Poll for a new Transmit to send over a socket.

Source

fn allocated_udp_socket( &mut self, transport: TransportType, local_addr: SocketAddr, remote_addr: SocketAddr, family: AddressFamily, socket_addr: Result<SocketAddr, SocketAllocateError>, now: Instant, )

Notify the TurnServerApi that a UDP socket has been allocated (or an error) in response to TurnServerPollRet::AllocateSocketUdp.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl TurnServerApi for OpensslTurnServer

Available on crate feature openssl only.
Source§

impl TurnServerApi for RustlsTurnServer

Available on crate feature rustls only.
Source§

impl TurnServerApi for TurnServer