diff --git a/README.md b/README.md index 762f924..cebe430 100644 --- a/README.md +++ b/README.md @@ -10,4 +10,3 @@ features: - libmusl static release builds, no libc dependency - lighter alternative to fail2ban -Todo: more granular CLI args to filter HTTP Status codes (e.g. 5 401 leads to a block, but 30 404 before a block) ? diff --git a/src/main.rs b/src/main.rs index 92b1833..5cff1b9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -43,7 +43,7 @@ fn judge( async fn run() -> Result<()> { let args = utils::cli().get_matches(); - let mut lines = MuxedLines::new()?; + let mut lines = MuxedLines::new().context("parsing cli args")?; // jail let jailtime_str = args.value_of("jailtime").unwrap_or(""); @@ -52,7 +52,7 @@ async fn run() -> Result<()> { let allowance_str = args.value_of("allowance").unwrap_or(""); let allowance = allowance_str.parse().context("parsing allowance")?; - let jail = Jail::new(allowance, jailtime)?; + let jail = Jail::new(allowance, jailtime).context("init jail")?; eprintln!( "+ jail setup, offences allowed: {}, jailtime {}s", allowance, jailtime @@ -68,7 +68,7 @@ async fn run() -> Result<()> { // common log format let path_clf = args.value_of("clf_logpath").unwrap_or(""); if !path_clf.is_empty() { - lines.add_file(path_clf).await?; + lines.add_file(path_clf).await.context("opening log file")?; eprintln!("+ starting with clf parsing at {}", path_clf); } diff --git a/src/utils.rs b/src/utils.rs index afd98a8..0045b5b 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -29,14 +29,14 @@ pub fn cli() -> App<'static, 'static> { Arg::with_name("jailtime") .short("j") .help("jail time (seconds)") - .default_value("3600") + .default_value("7200") .takes_value(true), ) .arg( Arg::with_name("allowance") .short("a") .help("how many offences allowed (max 255") - .default_value("5") + .default_value("6") .takes_value(true), ) .arg(