16 releases

Uses new Rust 2024

0.6.0 Aug 7, 2025
0.5.3 Feb 20, 2025
0.5.2 Jun 6, 2024
0.5.1 Sep 18, 2023
0.1.2 Feb 11, 2017

#886 in Network programming

Download history 2870/week @ 2025-11-14 2681/week @ 2025-11-21 2094/week @ 2025-11-28 1826/week @ 2025-12-05 2508/week @ 2025-12-12 1322/week @ 2025-12-19 784/week @ 2025-12-26 1406/week @ 2026-01-02 1820/week @ 2026-01-09 2324/week @ 2026-01-16 2684/week @ 2026-01-23 3533/week @ 2026-01-30 2543/week @ 2026-02-06 4117/week @ 2026-02-13 3014/week @ 2026-02-20 2440/week @ 2026-02-27

12,933 downloads per month
Used in netavark

MIT license

19KB
416 lines

Rust iptables

crates.io Documentation Build License

This crate provides bindings for iptables application in Linux (inspired by go-iptables). This crate uses iptables binary to manipulate chains and tables. This source code is licensed under MIT license that can be found in the LICENSE file.

[dependencies]
iptables = "*"

Getting started

1- Import the crate iptables and manipulate chains:

let ipt = iptables::new(false).unwrap();

assert!(ipt.new_chain("nat", "NEWCHAINNAME").is_ok());
assert!(ipt.append("nat", "NEWCHAINNAME", "-j ACCEPT").is_ok());
assert!(ipt.exists("nat", "NEWCHAINNAME", "-j ACCEPT").unwrap());
assert!(ipt.delete("nat", "NEWCHAINNAME", "-j ACCEPT").is_ok());
assert!(ipt.delete_chain("nat", "NEWCHAINNAME").is_ok());

For more information, please check the test file in tests folder.

Dependencies

~1.9–3MB
~51K SLoC