feat(server): unify WireGuard into the shared server transport pipeline
This commit is contained in:
@@ -86,6 +86,16 @@ impl IpPool {
|
||||
client_id
|
||||
}
|
||||
|
||||
/// Reserve a specific IP for a client (e.g., WireGuard static IP from allowed_ips).
|
||||
pub fn reserve(&mut self, ip: Ipv4Addr, client_id: &str) -> Result<()> {
|
||||
if self.allocated.contains_key(&ip) {
|
||||
anyhow::bail!("IP {} is already allocated", ip);
|
||||
}
|
||||
self.allocated.insert(ip, client_id.to_string());
|
||||
info!("Reserved IP {} for client {}", ip, client_id);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Number of currently allocated IPs.
|
||||
pub fn allocated_count(&self) -> usize {
|
||||
self.allocated.len()
|
||||
|
||||
Reference in New Issue
Block a user