Skip to content

Commit

Permalink
Prepend command
Browse files Browse the repository at this point in the history
  • Loading branch information
Orhideous committed Dec 15, 2023
1 parent ea87fe1 commit 03a8cd0
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>()
.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?<list..>")]
Expand Down

0 comments on commit 03a8cd0

Please sign in to comment.