| Crates.io | nfq |
| lib.rs | nfq |
| version | 0.2.5 |
| created_at | 2019-09-01 04:46:36.608447+00 |
| updated_at | 2022-01-26 08:35:21.470795+00 |
| description | Rust library for dealing with NetFilter queue |
| homepage | https://github.com/nbdd0121/nfq-rs |
| repository | https://github.com/nbdd0121/nfq-rs.git |
| max_upload_size | |
| id | 161260 |
| size | 75,728 |
nfq is Rust library for performing userspace handling of packets queued by the kernel packet
packet filter chains.
In contrast to libnetfilter_queue which is licensed under GPL 2.0, which will require all
binaries using that library to be bound by GPL, nfq is dual-licensed under MIT/Apache-2.0.
nfq achieves this by communicates with kernel via NETLINK sockets directly.
Here is an example which accepts all packets.
use nfq::{Queue, Verdict};
fn main() -> std::io::Result<()> {
let mut queue = Queue::open()?;
queue.bind(0)?;
loop {
let mut msg = queue.recv()?;
msg.set_verdict(Verdict::Accept);
queue.verdict(msg)?;
}
Ok(())
}