use live::loader::PreProcess;
pub use crate::layers::l4::tcp::TcpConfig;
pub use crate::layers::l4::udp::UdpConfig;
pub use crate::layers::l4p::model::ResolverConfig;
pub use crate::layers::l7::model::ApplicationConfig;
pub use crate::lazycert::config::LazyCertConfig;
pub use crate::resources::certs::arcswap::LoadedCert as CertEntry;
pub use crate::resources::service_discovery::model::NodesConfig;
use crate::resources::service_discovery::model::ProcessedNode;
impl PreProcess for TcpConfig {
fn pre_process(&mut self) {
if let Self::Legacy(config) = self {
for rule in &mut config.rules {
rule.name = rule.name.to_lowercase();
}
}
}
}
impl PreProcess for UdpConfig {
fn pre_process(&mut self) {
if let Self::Legacy(config) = self {
for rule in &mut config.rules {
rule.name = rule.name.to_lowercase();
}
}
}
}
impl PreProcess for NodesConfig {
fn pre_process(&mut self) {
let mut processed_list = Vec::new();
for node in &self.nodes {
for ip_config in &node.ips {
for &port in &ip_config.ports {
processed_list.push(ProcessedNode {
node_name: node.name.clone(),
address: ip_config.address.clone(),
port,
ip_type: ip_config.r#type.clone(),
});
}
}
}
self.processed = processed_list;
}
}
impl PreProcess for LazyCertConfig {
fn pre_process(&mut self) {
self.url = self.url.trim_end_matches('/').to_owned();
}
}
impl PreProcess for ResolverConfig {
fn set_context(&mut self, ctx: &str) {
self.protocol = ctx.to_owned();
}
}
impl PreProcess for ApplicationConfig {
fn set_context(&mut self, ctx: &str) {
self.protocol = ctx.to_owned();
}
}