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