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§
Sourcefn add_user(&mut self, username: String, password: String)
fn add_user(&mut self, username: String, password: String)
Add a user credentials that would be accepted by this TurnServerApi.
Sourcefn listen_address(&self) -> SocketAddr
fn listen_address(&self) -> SocketAddr
The address that the TurnServerApi is listening on for incoming client connections.
Sourcefn set_nonce_expiry_duration(&mut self, expiry_duration: Duration)
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.
Sourcefn recv<T: AsRef<[u8]> + Debug>(
&mut self,
transmit: Transmit<T>,
now: Instant,
) -> Option<TransmitBuild<DelayedMessageOrChannelSend<T>>>
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.
Sourcefn recv_icmp<T: AsRef<[u8]>>(
&mut self,
family: AddressFamily,
bytes: T,
now: Instant,
) -> Option<Transmit<Vec<u8>>>
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.
Sourcefn poll(&mut self, now: Instant) -> TurnServerPollRet
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.
Sourcefn poll_transmit(&mut self, now: Instant) -> Option<Transmit<Vec<u8>>>
fn poll_transmit(&mut self, now: Instant) -> Option<Transmit<Vec<u8>>>
Poll for a new Transmit to send over a socket.
Sourcefn allocated_udp_socket(
&mut self,
transport: TransportType,
local_addr: SocketAddr,
remote_addr: SocketAddr,
family: AddressFamily,
socket_addr: Result<SocketAddr, SocketAllocateError>,
now: Instant,
)
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§
impl TurnServerApi for OpensslTurnServer
openssl only.impl TurnServerApi for RustlsTurnServer
rustls only.