#nf-tables #async

nftables-async

An async version of the helper to run nftables, providing full compatibility with the rest of the nftables crate

6 releases (3 breaking)

0.4.1 May 11, 2026
0.4.0 Apr 16, 2025
0.3.0 Mar 23, 2025
0.2.2 Dec 1, 2024
0.1.1 Oct 27, 2024

#15 in #nf-tables

Download history 68435/week @ 2026-02-01 66256/week @ 2026-02-08 43759/week @ 2026-02-15 26591/week @ 2026-02-22 24215/week @ 2026-03-01 29654/week @ 2026-03-08 10615/week @ 2026-03-15 13837/week @ 2026-03-22 5028/week @ 2026-03-29 3173/week @ 2026-04-05 3235/week @ 2026-04-12 3760/week @ 2026-04-19 4933/week @ 2026-04-26 5973/week @ 2026-05-03 7259/week @ 2026-05-10 12026/week @ 2026-05-17

30,568 downloads per month
Used in 4 crates (via fcnet)

MIT license

15KB
245 lines

nftables-async

An async version of the helper to run nftables in the nftables crate. Simply add both nftables-async and nftables to your crate, then use the nftables_async::apply_ruleset or nftables_async::get_current_ruleset to perform manipulations. Everything is compatible with the sync helper, even the error types, the functions, however, return "true" async futures.

To provide the asynchronous I/O, an implementation of the Process trait in the crate is needed. Two implementations are provided built-in behind feature gates:

  1. TokioProcess using the Tokio stack, enabled via tokio-process feature
  2. AsyncProcess using the async-process crate (Smol stack), enabled via async-process feature.

Why not the async helpers in nftables >0.6?

nftables 0.6.0 introduced tokio and async-process features that are mostly equivalent to this crate, however, these have some disadvantages that make nftables-async still relevant:

  1. The support in nftables is not implemented via a trait (like nftables_async::Process), meaning third-party extensions for async platforms other than Tokio or the async-* stack are not easily possible.
  2. The two features are mutually exclusive, making it impossible to compile an nftables that has both enabled. This breaks the use-case of fcnet, that needs both when enabling multiple runtime features, and is generally inconvenient.

Dependencies

~0.9–6.5MB
~143K SLoC