From f51746c5df37ba9c5f148cd52696a8d5ca8cf13a Mon Sep 17 00:00:00 2001 From: Dreaded_X Date: Tue, 21 Apr 2026 04:46:31 +0200 Subject: [PATCH] feat: Add function that applies netmask to ip --- src/environment.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/environment.rs b/src/environment.rs index 5836d34..904e36e 100644 --- a/src/environment.rs +++ b/src/environment.rs @@ -16,6 +16,13 @@ pub struct PathEnvironment<'a> { path: PathBuf, } +fn apply_netmask( + ip: ViaDeserialize, + netmask: ViaDeserialize, +) -> Result { + Ok((*ip & *netmask).to_string()) +} + impl<'a> PathEnvironment<'a> { pub fn new(path: &Path) -> Self { let mut env = Environment::new(); @@ -41,6 +48,8 @@ impl<'a> PathEnvironment<'a> { } }); + env.add_function("apply_netmask", apply_netmask); + // Helper function for getting the path to kubeconfig files env.add_filter("kubeconfig", move |names: Vec| { names