14 releases

0.5.2 Jun 6, 2024
0.5.1 Sep 18, 2023
0.5.0 Feb 1, 2022
0.4.3 Mar 7, 2021
0.1.2 Feb 11, 2017

#298 in Network programming

Download history 1912/week @ 2024-10-18 1949/week @ 2024-10-25 1902/week @ 2024-11-01 1932/week @ 2024-11-08 1603/week @ 2024-11-15 1604/week @ 2024-11-22 1786/week @ 2024-11-29 1514/week @ 2024-12-06 1693/week @ 2024-12-13 929/week @ 2024-12-20 965/week @ 2024-12-27 1749/week @ 2025-01-03 1612/week @ 2025-01-10 1512/week @ 2025-01-17 1253/week @ 2025-01-24 867/week @ 2025-01-31

5,513 downloads per month

MIT license

20KB
442 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

~5MB
~90K SLoC