diff --git a/src/main.rs b/src/main.rs index 538da71..f12a12d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,17 +16,15 @@ fn process_cidr_block(blocks: &str, country_request: CountryRequest) -> String { name, timeout, } = country_request; - blocks - .trim() - .split('\n') - .map(|s| { - format!( - ":do {{ add address={} list={} timeout={} comment={} }} on-error={{}}", - s, name, timeout, country - ) - }) - .collect::>() - .join("\n") + let add_commands = blocks.trim().split('\n').map(|s| { + format!( + ":do {{ add address={} list={} timeout={} comment={} }} on-error={{}}", + s, name, timeout, country + ) + }); + let mut commands = vec![String::from("/ip firewall address-list")]; + commands.extend(add_commands); + commands.join("\n") } #[get("/api/v0/list?")]