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