feat: assign mac / gateway

This commit is contained in:
2024-11-29 11:18:02 +00:00
parent 1cc4d40082
commit 06d8339653
14 changed files with 238 additions and 16 deletions

18
src/router/mod.rs Normal file
View File

@ -0,0 +1,18 @@
use anyhow::Result;
use rocket::async_trait;
use std::net::IpAddr;
/// Router defines a network device used to access the hosts
///
/// In our infrastructure we use this to add static ARP entries on the router
/// for every IP assignment, this way we don't need to have a ton of ARP requests on the
/// VM network because of people doing IP scanning
///
/// It also prevents people from re-assigning their IP to another in the range,
#[async_trait]
pub trait Router {
async fn add_arp_entry(&self, ip: IpAddr, mac: &[u8; 6], comment: Option<&str>) -> Result<()>;
}
mod mikrotik;
pub use mikrotik::*;