15 releases

Uses new Rust 2024

0.5.3 Feb 20, 2025
0.5.2 Jun 6, 2024
0.5.1 Sep 18, 2023
0.5.0 Feb 1, 2022
0.1.2 Feb 11, 2017

#445 in Network programming

Download history 1253/week @ 2025-01-24 1203/week @ 2025-01-31 2536/week @ 2025-02-07 1843/week @ 2025-02-14 1621/week @ 2025-02-21 1859/week @ 2025-02-28 2444/week @ 2025-03-07 2616/week @ 2025-03-14 2745/week @ 2025-03-21 3063/week @ 2025-03-28 2401/week @ 2025-04-04 2620/week @ 2025-04-11 2335/week @ 2025-04-18 2404/week @ 2025-04-25 2385/week @ 2025-05-02 2005/week @ 2025-05-09

9,632 downloads per month
Used in 2 crates

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
~92K SLoC

OSZAR »