feat: Add OKD DNS score with DNS entries and registering dhcp leases

This commit is contained in:
Jean-Gabriel Gill-Couture
2024-12-18 15:58:49 -05:00
parent b098757683
commit 367e96b36a
11 changed files with 367 additions and 31 deletions

View File

@@ -18,6 +18,14 @@ thiserror = "1.0"
async-trait = { workspace = true }
tokio = { workspace = true }
[dependencies.uuid]
version = "1.11.0"
features = [
"v4", # Lets you generate random UUIDs
"fast-rng", # Use a faster (but still sufficiently random) RNG
"macro-diagnostics", # Enable better diagnostics for compile-time UUIDs
]
[dev-dependencies]
pretty_assertions = "1.4.1"

View File

@@ -1,5 +1,6 @@
use crate::{data::dhcpd::DhcpInterface, xml_utils::to_xml_str};
use log::error;
use uuid::Uuid;
use yaserde::{MaybeString, NamedList, RawXml};
use yaserde_derive::{YaDeserialize, YaSerialize};
@@ -1167,18 +1168,34 @@ pub struct Hosts {
pub hosts: Vec<Host>,
}
#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)]
#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)]
pub struct Host {
#[yaserde(attribute)]
pub uuid: String,
pub enabled: i32,
pub enabled: i8,
pub hostname: String,
pub domain: String,
pub rr: String,
pub mxprio: MaybeString,
pub mx: MaybeString,
pub server: String,
pub description: String,
pub description: Option<String>,
}
impl Host {
pub fn new(hostname: String, domain: String, rr: String, server: String) -> Self {
Host {
uuid: Uuid::new_v4().to_string(),
enabled: true as i8,
hostname,
domain,
rr,
server,
mxprio: MaybeString::default(),
mx: MaybeString::default(),
description: None
}
}
}
#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)]
@@ -1468,7 +1485,6 @@ pub struct Tuning {
pub h2_max_concurrent_streams_outgoing: Option<MaybeString>,
#[yaserde(rename = "h2_maxConcurrentStreamsIncoming")]
pub h2_max_concurrent_streams_incoming: Option<MaybeString>,
}
#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)]