webrtc_turn/relay/
mod.rs

1pub mod relay_none;
2pub mod relay_range;
3pub mod relay_static;
4
5use util::{Conn, Error};
6
7use std::net::SocketAddr;
8use std::sync::Arc;
9
10use async_trait::async_trait;
11
12// RelayAddressGenerator is used to generate a RelayAddress when creating an allocation.
13// You can use one of the provided ones or provide your own.
14#[async_trait]
15pub trait RelayAddressGenerator {
16    // validate confirms that the RelayAddressGenerator is properly initialized
17    fn validate(&self) -> Result<(), Error>;
18
19    // Allocate a RelayAddress
20    async fn allocate_conn(
21        &self,
22        use_ipv4: bool,
23        requested_port: u16,
24    ) -> Result<(Arc<dyn Conn + Send + Sync>, SocketAddr), Error>;
25}