Crates.io | nftnl-rs |
lib.rs | nftnl-rs |
version | 0.5.0 |
created_at | 2024-03-18 00:01:57.86097+00 |
updated_at | 2025-06-21 17:10:35.524791+00 |
description | A Rust crate for Linux Netlink Nftables client for direct control on the netfilter via netlink socket. |
homepage | |
repository | https://repo.4neko.org/4NEKO/nftnl-rs |
max_upload_size | |
id | 1176903 |
size | 173,314 |
This is a crate (currently in development) which implements a netlink
protocol to communicate with
the Linux Nftables firewall.
This crate was developed only for the tables/sets manipulations i.e add/del/get!!!
At the moment this crate allows to:
For examples, see /examples/ directory.
Get IP from the table's set. i.e performing the following command:
$ sudo nft list set ip table-test table-set
use std::{net::IpAddr, str::FromStr};
use nftnl_rs::Nfprot
fn main()
{
let hosts = [IpAddr::from_str("127.0.1.3").unwrap(), IpAddr::from_str("127.0.1.4").unwrap()];
let res = nftnl_rs::add_hosts_to_table(hosts.as_slice(), "table-test", "table-set");
}