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> {
|
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;
|
||||||
|
@ -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,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user