pub struct Allocation { /* private fields */ }Expand description
Allocation is tied to a FiveTuple and relays traffic
use create_allocation and get_allocation to operate.
Implementations§
Source§impl Allocation
impl Allocation
Sourcepub fn new(
turn_socket: Arc<dyn Conn + Send + Sync>,
relay_socket: Arc<dyn Conn + Send + Sync>,
relay_addr: SocketAddr,
five_tuple: FiveTuple,
username: Username,
allocation_map: Weak<Mutex<AllocationMap>>,
alloc_close_notify: Option<Sender<AllocationInfo>>,
) -> Self
pub fn new( turn_socket: Arc<dyn Conn + Send + Sync>, relay_socket: Arc<dyn Conn + Send + Sync>, relay_addr: SocketAddr, five_tuple: FiveTuple, username: Username, allocation_map: Weak<Mutex<AllocationMap>>, alloc_close_notify: Option<Sender<AllocationInfo>>, ) -> Self
Creates a new Allocation.
Sourcepub async fn has_permission(&self, addr: &SocketAddr) -> bool
pub async fn has_permission(&self, addr: &SocketAddr) -> bool
Checks the Permission for the addr.
Sourcepub async fn add_permission(&self, p: Permission)
pub async fn add_permission(&self, p: Permission)
Adds a new Permission to this Allocation.
Sourcepub async fn remove_permission(&self, addr: &SocketAddr) -> bool
pub async fn remove_permission(&self, addr: &SocketAddr) -> bool
Removes the addr’s fingerprint from this Allocation’s permissions.
Sourcepub async fn add_channel_bind(
&self,
c: ChannelBind,
lifetime: Duration,
) -> Result<(), Error>
pub async fn add_channel_bind( &self, c: ChannelBind, lifetime: Duration, ) -> Result<(), Error>
Adds a new ChannelBind to this Allocation, it also updates the
permissions needed for this ChannelBind.
Sourcepub async fn remove_channel_bind(&self, number: ChannelNumber) -> bool
pub async fn remove_channel_bind(&self, number: ChannelNumber) -> bool
Removes the ChannelBind from this Allocation by number.
Sourcepub async fn get_channel_addr(
&self,
number: &ChannelNumber,
) -> Option<SocketAddr>
pub async fn get_channel_addr( &self, number: &ChannelNumber, ) -> Option<SocketAddr>
Gets the ChannelBind’s address by number.
Sourcepub async fn get_channel_number(
&self,
addr: &SocketAddr,
) -> Option<ChannelNumber>
pub async fn get_channel_number( &self, addr: &SocketAddr, ) -> Option<ChannelNumber>
Gets the ChannelBind’s number from this Allocation by addr.
pub async fn start(&self, lifetime: Duration)
Auto Trait Implementations§
impl !Freeze for Allocation
impl !RefUnwindSafe for Allocation
impl !UnwindSafe for Allocation
impl Send for Allocation
impl Sync for Allocation
impl Unpin for Allocation
impl UnsafeUnpin for Allocation
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