pub struct Manager { /* private fields */ }Expand description
Manager is used to hold active allocations.
Implementations§
Source§impl Manager
impl Manager
Sourcepub fn new(config: ManagerConfig) -> Self
pub fn new(config: ManagerConfig) -> Self
Creates a new Manager.
Sourcepub async fn close(&self) -> Result<(), Error>
pub async fn close(&self) -> Result<(), Error>
Closes this [manager] and closes all Allocations it manages.
Sourcepub async fn get_allocations_info(
&self,
five_tuples: Option<Vec<FiveTuple>>,
) -> HashMap<FiveTuple, AllocationInfo>
pub async fn get_allocations_info( &self, five_tuples: Option<Vec<FiveTuple>>, ) -> HashMap<FiveTuple, AllocationInfo>
Returns the information about the all Allocations associated with
the specified FiveTuples.
Sourcepub async fn get_allocation(
&self,
five_tuple: &FiveTuple,
) -> Option<Arc<Allocation>>
pub async fn get_allocation( &self, five_tuple: &FiveTuple, ) -> Option<Arc<Allocation>>
Fetches the Allocation matching the passed FiveTuple.
Sourcepub async fn create_allocation(
&self,
five_tuple: FiveTuple,
turn_socket: Arc<dyn Conn + Send + Sync>,
requested_port: u16,
lifetime: Duration,
username: Username,
use_ipv4: bool,
) -> Result<Arc<Allocation>, Error>
pub async fn create_allocation( &self, five_tuple: FiveTuple, turn_socket: Arc<dyn Conn + Send + Sync>, requested_port: u16, lifetime: Duration, username: Username, use_ipv4: bool, ) -> Result<Arc<Allocation>, Error>
Creates a new Allocation and starts relaying.
Sourcepub async fn delete_allocation(&self, five_tuple: &FiveTuple)
pub async fn delete_allocation(&self, five_tuple: &FiveTuple)
Removes an Allocation.
Sourcepub async fn delete_allocations_by_username(&self, name: &str)
pub async fn delete_allocations_by_username(&self, name: &str)
Deletes the Allocations according to the specified username name.
Sourcepub async fn create_reservation(&self, reservation_token: String, port: u16)
pub async fn create_reservation(&self, reservation_token: String, port: u16)
Stores the reservation for the token+port.
Sourcepub async fn get_reservation(&self, reservation_token: &str) -> Option<u16>
pub async fn get_reservation(&self, reservation_token: &str) -> Option<u16>
Returns the port for a given reservation if it exists.
Sourcepub async fn get_random_even_port(&self) -> Result<u16, Error>
pub async fn get_random_even_port(&self) -> Result<u16, Error>
Returns a random un-allocated udp4 port.
Auto Trait Implementations§
impl !RefUnwindSafe for Manager
impl !UnwindSafe for Manager
impl Freeze for Manager
impl Send for Manager
impl Sync for Manager
impl Unpin for Manager
impl UnsafeUnpin for Manager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more