feat(bootstrapping): add bootstrap load balancer and DHCP configurations

- Introduce `bootstrap_load_balancer` module for handling initial load balancing configuration.
- Add `bootstrap_dhcp` module for bootstrapping DHCP settings.
- Create `harmony_types` crate to house shared types, including `MacAddress`.
- Update `harmony_macros` to use `harmony_types` instead of directly referencing `harmony`.
This commit is contained in:
jeangab
2025-01-09 11:58:49 -05:00
parent a80ead418e
commit bec96c2954
20 changed files with 208 additions and 55 deletions

View File

@@ -0,0 +1,4 @@
[package]
name = "harmony_types"
edition = "2024"
version = "1.0.0"

View File

@@ -0,0 +1,26 @@
pub mod net {
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct MacAddress(pub [u8; 6]);
impl MacAddress {
#[cfg(test)]
pub fn dummy() -> Self {
Self([0, 0, 0, 0, 0, 0])
}
}
impl From<&MacAddress> for String {
fn from(value: &MacAddress) -> Self {
format!(
"{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}",
value.0[0], value.0[1], value.0[2], value.0[3], value.0[4], value.0[5]
)
}
}
impl std::fmt::Display for MacAddress {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_fmt(format_args!("MacAddress {}", String::from(self)))
}
}
}