for testing
This commit is contained in:
parent
3e2fc8ddde
commit
f1d0ff01ef
@ -170,7 +170,7 @@ impl Context {
|
||||
pub async fn update_blocklist(&mut self, ipdata: &IpData) -> Option<IpData> {
|
||||
if self.blocklist.contains_key(&ipdata.ip)
|
||||
&& self.hostname == ipdata.hostname
|
||||
&& ipdata.src == "file"
|
||||
&& ipdata.mode == "file".to_string()
|
||||
{
|
||||
let mut block = self.blocklist.get_mut(&ipdata.ip).unwrap();
|
||||
block.tryfail += 1;
|
||||
|
@ -60,11 +60,12 @@ impl Display for IpData {
|
||||
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"ip: {ip}, src: {src}, date: {date}, hostname: {hostname}",
|
||||
"ip: {ip}, src: {src}, date: {date}, hostname: {hostname}, mode: {mode}",
|
||||
ip = self.ip,
|
||||
src = self.src,
|
||||
date = self.date,
|
||||
hostname = self.hostname,
|
||||
mode = self.mode,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -77,6 +77,7 @@ pub async fn process(ctx: &Arc<Mutex<Context>>) {
|
||||
// refresh context blocklist
|
||||
let filtered_ip = ctx.update_blocklist(&received_ip).await;
|
||||
ctx.gc_blocklist().await;
|
||||
println!("{:?}", filtered_ip);
|
||||
|
||||
// send ip list to ws and zmq sockets
|
||||
if let Some(ip) = filtered_ip {
|
||||
|
Loading…
Reference in New Issue
Block a user