for testing

This commit is contained in:
Paul 2022-09-18 00:41:29 +02:00
parent 3e2fc8ddde
commit f1d0ff01ef
3 changed files with 4 additions and 2 deletions

View File

@ -170,7 +170,7 @@ impl Context {
pub async fn update_blocklist(&mut self, ipdata: &IpData) -> Option<IpData> { pub async fn update_blocklist(&mut self, ipdata: &IpData) -> Option<IpData> {
if self.blocklist.contains_key(&ipdata.ip) if self.blocklist.contains_key(&ipdata.ip)
&& self.hostname == ipdata.hostname && self.hostname == ipdata.hostname
&& ipdata.src == "file" && ipdata.mode == "file".to_string()
{ {
let mut block = self.blocklist.get_mut(&ipdata.ip).unwrap(); let mut block = self.blocklist.get_mut(&ipdata.ip).unwrap();
block.tryfail += 1; block.tryfail += 1;

View File

@ -60,11 +60,12 @@ impl Display for IpData {
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result { fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
write!( write!(
f, f,
"ip: {ip}, src: {src}, date: {date}, hostname: {hostname}", "ip: {ip}, src: {src}, date: {date}, hostname: {hostname}, mode: {mode}",
ip = self.ip, ip = self.ip,
src = self.src, src = self.src,
date = self.date, date = self.date,
hostname = self.hostname, hostname = self.hostname,
mode = self.mode,
) )
} }
} }

View File

@ -77,6 +77,7 @@ pub async fn process(ctx: &Arc<Mutex<Context>>) {
// refresh context blocklist // refresh context blocklist
let filtered_ip = ctx.update_blocklist(&received_ip).await; let filtered_ip = ctx.update_blocklist(&received_ip).await;
ctx.gc_blocklist().await; ctx.gc_blocklist().await;
println!("{:?}", filtered_ip);
// send ip list to ws and zmq sockets // send ip list to ws and zmq sockets
if let Some(ip) = filtered_ip { if let Some(ip) = filtered_ip {