mirror of
https://github.com/pldubouilh/blockfast.git
synced 2026-09-02 23:27:39 -04:00
document and tweak settings
This commit is contained in:
@@ -10,4 +10,3 @@ features:
|
|||||||
- libmusl static release builds, no libc dependency
|
- libmusl static release builds, no libc dependency
|
||||||
- lighter alternative to fail2ban
|
- 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) ?
|
|
||||||
|
|||||||
+3
-3
@@ -43,7 +43,7 @@ fn judge(
|
|||||||
|
|
||||||
async fn run() -> Result<()> {
|
async fn run() -> Result<()> {
|
||||||
let args = utils::cli().get_matches();
|
let args = utils::cli().get_matches();
|
||||||
let mut lines = MuxedLines::new()?;
|
let mut lines = MuxedLines::new().context("parsing cli args")?;
|
||||||
|
|
||||||
// jail
|
// jail
|
||||||
let jailtime_str = args.value_of("jailtime").unwrap_or("");
|
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_str = args.value_of("allowance").unwrap_or("");
|
||||||
let allowance = allowance_str.parse().context("parsing allowance")?;
|
let allowance = allowance_str.parse().context("parsing allowance")?;
|
||||||
|
|
||||||
let jail = Jail::new(allowance, jailtime)?;
|
let jail = Jail::new(allowance, jailtime).context("init jail")?;
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"+ jail setup, offences allowed: {}, jailtime {}s",
|
"+ jail setup, offences allowed: {}, jailtime {}s",
|
||||||
allowance, jailtime
|
allowance, jailtime
|
||||||
@@ -68,7 +68,7 @@ async fn run() -> Result<()> {
|
|||||||
// common log format
|
// common log format
|
||||||
let path_clf = args.value_of("clf_logpath").unwrap_or("");
|
let path_clf = args.value_of("clf_logpath").unwrap_or("");
|
||||||
if !path_clf.is_empty() {
|
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);
|
eprintln!("+ starting with clf parsing at {}", path_clf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -29,14 +29,14 @@ pub fn cli() -> App<'static, 'static> {
|
|||||||
Arg::with_name("jailtime")
|
Arg::with_name("jailtime")
|
||||||
.short("j")
|
.short("j")
|
||||||
.help("jail time (seconds)")
|
.help("jail time (seconds)")
|
||||||
.default_value("3600")
|
.default_value("7200")
|
||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("allowance")
|
Arg::with_name("allowance")
|
||||||
.short("a")
|
.short("a")
|
||||||
.help("how many offences allowed (max 255")
|
.help("how many offences allowed (max 255")
|
||||||
.default_value("5")
|
.default_value("6")
|
||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
|||||||
Reference in New Issue
Block a user