nftables/lib.rs
1//! nftables-rs is a Rust library designed to provide a safe and easy-to-use abstraction over the nftables JSON API, known as libnftables-json.
2//!
3//! This library is engineered for developers who need to interact with nftables,
4//! the Linux kernel's next-generation firewalling tool, directly from Rust applications.
5//!
6//! By abstracting the underlying JSON API, nftables-rs facilitates the creation, manipulation,
7//! and application of firewall rulesets without requiring deep knowledge of nftables' internal workings.
8
9// TODO: add example usage to library doc
10
11/// Contains Batch object to be used to prepare Nftables payloads.
12pub mod batch;
13
14/// Contains [expressions](crate::expr::Expression).
15/// Expressions are the building blocks of (most) statements.
16///
17/// See <https://manpages.debian.org/testing/libnftables1/libnftables-json.5.en.html#EXPRESSIONS>.
18pub mod expr;
19
20/// Contains the global structure of an Nftables document.
21///
22/// See <https://manpages.debian.org/testing/libnftables1/libnftables-json.5.en.html#GLOBAL_STRUCTURE>.
23pub mod schema;
24
25/// Contains Statements.
26/// Statements are the building blocks for rules.
27///
28/// See <https://manpages.debian.org/testing/libnftables1/libnftables-json.5.en.html#STATEMENTS>.
29pub mod stmt;
30
31/// Contains common type definitions referred to in the schema.
32pub mod types;
33
34/// Contains methods to communicate with nftables JSON API.
35pub mod helper;
36
37/// Contains node visitors for serde.
38pub mod visitor;
39
40/// Contains handling and parsing of command line arguments.
41pub mod cli;
42
43// Default values for Default implementations.
44const DEFAULT_FAMILY: types::NfFamily = types::NfFamily::INet;
45const DEFAULT_TABLE: &str = "filter";
46const DEFAULT_CHAIN: &str = "forward";