version 1.8.0 #15
@ -1,6 +1,6 @@
|
|||||||
use rustables::*;
|
use rustables::*;
|
||||||
use rustables::{expr::*, set::*, Batch, Chain, MsgType, ProtocolFamily, Rule, Table};
|
use rustables::{expr::*, Chain, Rule, Table};
|
||||||
use std::{ffi::*, io::*, net::*};
|
use std::{io::*, net::*};
|
||||||
|
|
||||||
const TABLE_NAME: &str = "ipblc4";
|
const TABLE_NAME: &str = "ipblc4";
|
||||||
const CHAIN_NAME: &str = "ipblc";
|
const CHAIN_NAME: &str = "ipblc";
|
||||||
@ -68,18 +68,18 @@ fn main() -> Result<()> {
|
|||||||
|
|
||||||
let mut gexpr = RawExpression::default();
|
let mut gexpr = RawExpression::default();
|
||||||
for e in cmprule.get_expressions().unwrap().iter() {
|
for e in cmprule.get_expressions().unwrap().iter() {
|
||||||
if let Some(ExpressionVariant::Cmp(ip)) = e.get_data() {
|
if let Some(ExpressionVariant::Cmp(_)) = e.get_data() {
|
||||||
gexpr = e.clone();
|
gexpr = e.clone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let rules = list_rules_for_chain(&chain).unwrap();
|
let rules = list_rules_for_chain(&chain).unwrap();
|
||||||
for mut rule in rules {
|
for rule in rules {
|
||||||
let handle = rule.get_handle().unwrap();
|
let handle = rule.get_handle().unwrap();
|
||||||
println!("handle {}", handle);
|
println!("handle {}", handle);
|
||||||
let exprs = rule.get_expressions().unwrap();
|
let exprs = rule.get_expressions().unwrap();
|
||||||
for expr in exprs.iter() {
|
for expr in exprs.iter() {
|
||||||
if let Some(ExpressionVariant::Cmp(ip)) = expr.get_data() {
|
if let Some(ExpressionVariant::Cmp(_)) = expr.get_data() {
|
||||||
if expr.clone() == gexpr {
|
if expr.clone() == gexpr {
|
||||||
println!("{:?}", expr.get_data());
|
println!("{:?}", expr.get_data());
|
||||||
println!("test");
|
println!("test");
|
||||||
|
@ -169,9 +169,9 @@ impl Context {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub async fn get_blocklist_pending(&self) -> Vec<BlockIpData> {
|
pub async fn get_blocklist_pending(&self) -> Vec<BlockIpData> {
|
||||||
let mut res: Vec<IpData> = vec![];
|
let mut res: Vec<BlockIpData> = vec![];
|
||||||
for (_, v) in self.blocklist.iter() {
|
for (_, ipblock) in self.blocklist.iter() {
|
||||||
res.push(v.ipdata.clone());
|
res.push(ipblock.clone());
|
||||||
}
|
}
|
||||||
res
|
res
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user