feat(homelab): add dhcp lease parsing

This commit is contained in:
2026-01-02 18:15:03 -08:00
parent 8fa31858b4
commit 3005a07e28
9 changed files with 438 additions and 3 deletions

20
nix/homelab/src/dns.rs Normal file
View File

@@ -0,0 +1,20 @@
use crate::{
error::Result,
lease_parser::{Lease, parse_leases},
transport::Transport,
};
pub struct Router<T: Transport> {
transport: T,
}
impl<T: Transport> Router<T> {
pub fn new(transport: T) -> Self {
Self { transport }
}
pub fn dhcp_leases(&self, resource: &str) -> Result<Vec<Lease>> {
let raw = self.transport.fetch(resource)?;
parse_leases(&raw).map_err(|e| crate::error::Error::Parse(e.to_string()))
}
}