forked from NationTech/harmony
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:
4
harmony-rs/harmony_types/Cargo.toml
Normal file
4
harmony-rs/harmony_types/Cargo.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[package]
|
||||
name = "harmony_types"
|
||||
edition = "2024"
|
||||
version = "1.0.0"
|
||||
26
harmony-rs/harmony_types/src/lib.rs
Normal file
26
harmony-rs/harmony_types/src/lib.rs
Normal 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)))
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user