1
0

some refactor

This commit is contained in:
midefos 2024-08-30 12:29:24 +02:00
parent 0593a2bfea
commit 6154a858ce

View File

@ -103,18 +103,17 @@ async fn start_ban_server(
info!("listening changes over {}", ssh_auth_log.display());
loop {
let next_line = lines.next_line().await;
if let Err(err) = next_line {
error!("reading next file: {}", err);
continue;
}
let line = next_line.unwrap();
let line = next_line?;
if line.is_none() {
continue;
}
let line = line.unwrap();
if let Some(login_attempt) = LoginAttempt::capture(line.line()) {
info!(
"login attempt from {}@{}:{}",
@ -141,7 +140,7 @@ async fn start_ban_server(
}
}
None => {
login_attempts.insert(login_attempt.ip.clone(), 1);
login_attempts.insert(login_attempt.ip, 1);
}
}
}