ebpfsieve 0.1.0

Byte-frequency prefilter for read-heavy scanning pipelines with optional eBPF offload
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use ebpfsieve::{ByteFrequencyFilter, ByteThreshold};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let t = ByteThreshold::new(b'A', u16::MAX);
    let filter = ByteFrequencyFilter::new([t])?.with_window_size(65538)?;
    let input = vec![b'A'; 65538];
    let matches = filter.matching_windows(&input);
    println!("Test 1 (u16::MAX undercount) matches: {}", matches.len());

    let matches_iter: Vec<_> = filter.matching_windows_iter(&input).collect();
    println!("Test 2 (u16::MAX iter) matches: {}", matches_iter.len());
    Ok(())
}