Skip to main content

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>(
        &mut self,
        transmit: Transmit<T>,
        now: Instant,
    ) -> Option<TransmitBuild<DelayedMessageOrChannelSend<T>>>
       where T: AsRef<[u8]> + Debug;
    fn recv_icmp<T>(
        &mut self,
        family: AddressFamily,
        bytes: T,
        now: Instant,
    ) -> Option<Transmit<Vec<u8>>>
       where T: AsRef<[u8]>;
    fn poll(&mut self, now: Instant) -> TurnServerPollRet;
    fn poll_transmit(&mut self, now: Instant) -> Option<Transmit<Vec<u8>>>;
    fn allocated_socket(
        &mut self,
        transport: TransportType,
        listen_addr: SocketAddr,
        client_addr: SocketAddr,
        allocation_transport: TransportType,
        family: AddressFamily,
        socket_addr: Result<SocketAddr, SocketAllocateError>,
        now: Instant,
    );
    fn tcp_connected(
        &mut self,
        relayed_addr: SocketAddr,
        peer_addr: SocketAddr,
        listen_addr: SocketAddr,
        client_addr: SocketAddr,
        socket_addr: Result<SocketAddr, TcpConnectError>,
        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>( &mut self, transmit: Transmit<T>, now: Instant, ) -> Option<TransmitBuild<DelayedMessageOrChannelSend<T>>>
where T: AsRef<[u8]> + Debug,

Provide received data to the TurnServerApi.

Any returned Transmit should be forwarded to the appropriate socket.

Source

fn recv_icmp<T>( &mut self, family: AddressFamily, bytes: T, now: Instant, ) -> Option<Transmit<Vec<u8>>>
where T: AsRef<[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_socket( &mut self, transport: TransportType, listen_addr: SocketAddr, client_addr: SocketAddr, allocation_transport: TransportType, 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::AllocateSocket.

Source

fn tcp_connected( &mut self, relayed_addr: SocketAddr, peer_addr: SocketAddr, listen_addr: SocketAddr, client_addr: SocketAddr, socket_addr: Result<SocketAddr, TcpConnectError>, now: Instant, )

Indicate that a TCP connection has been configured (or an error) for a client to connect over TCP with a peer.

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§