12 releases

Uses new Rust 2021

0.5.0 Feb 1, 2022
0.4.3 Mar 7, 2021
0.4.2 Feb 24, 2021
0.4.1 Dec 28, 2020
0.1.2 Feb 11, 2017

#572 in Network programming

Download history 828/week @ 2022-03-10 898/week @ 2022-03-17 751/week @ 2022-03-24 547/week @ 2022-03-31 787/week @ 2022-04-07 690/week @ 2022-04-14 725/week @ 2022-04-21 904/week @ 2022-04-28 970/week @ 2022-05-05 720/week @ 2022-05-12 694/week @ 2022-05-19 335/week @ 2022-05-26 662/week @ 2022-06-02 525/week @ 2022-06-09 946/week @ 2022-06-16 1037/week @ 2022-06-23

3,292 downloads per month
Used in dfw

MIT license

19KB
442 lines

Rust iptables

crates.io Documentation Build Status 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 = "0.4"

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

~2.5MB
~64K SLoC