pub struct AddressPool { /* private fields */ }Expand description
IP address pool for assigning addresses to VPN clients
Implementations§
Source§impl AddressPool
impl AddressPool
Sourcepub fn new(ipv4_net: Option<Ipv4Net>, ipv6_net: Option<Ipv6Net>) -> Self
pub fn new(ipv4_net: Option<Ipv4Net>, ipv6_net: Option<Ipv6Net>) -> Self
Create a new address pool
§Arguments
ipv4_net- IPv4 network (e.g., “10.8.0.0/24”)ipv6_net- IPv6 network (e.g., “fd00::/64”)
Sourcepub fn gateway_v4(&self) -> Option<Ipv4Addr>
pub fn gateway_v4(&self) -> Option<Ipv4Addr>
Get the gateway IPv4 address
Sourcepub fn gateway_v6(&self) -> Option<Ipv6Addr>
pub fn gateway_v6(&self) -> Option<Ipv6Addr>
Get the gateway IPv6 address
Sourcepub fn allocate(&self) -> Result<VpnAddress>
pub fn allocate(&self) -> Result<VpnAddress>
Allocate an address from the pool
Sourcepub fn allocate_specific(&self, addr: VpnAddress) -> Result<VpnAddress>
pub fn allocate_specific(&self, addr: VpnAddress) -> Result<VpnAddress>
Allocate a specific address (for static assignment)
Sourcepub fn release(&self, addr: &VpnAddress)
pub fn release(&self, addr: &VpnAddress)
Release an address back to the pool
Sourcepub fn available_v4(&self) -> usize
pub fn available_v4(&self) -> usize
Get the number of available IPv4 addresses
Sourcepub fn available_v6(&self) -> usize
pub fn available_v6(&self) -> usize
Get the number of available IPv6 addresses
Auto Trait Implementations§
impl !Freeze for AddressPool
impl !RefUnwindSafe for AddressPool
impl Send for AddressPool
impl Sync for AddressPool
impl Unpin for AddressPool
impl UnwindSafe for AddressPool
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