11 unstable releases (3 breaking)

0.4.3 Mar 7, 2021
0.4.2 Feb 24, 2021
0.4.1 Dec 28, 2020
0.3.0 Dec 25, 2020
0.1.2 Feb 11, 2017

#558 in Network programming

Download history 829/week @ 2021-10-07 513/week @ 2021-10-14 440/week @ 2021-10-21 622/week @ 2021-10-28 534/week @ 2021-11-04 431/week @ 2021-11-11 492/week @ 2021-11-18 491/week @ 2021-11-25 356/week @ 2021-12-02 301/week @ 2021-12-09 440/week @ 2021-12-16 204/week @ 2021-12-23 324/week @ 2021-12-30 510/week @ 2022-01-06 792/week @ 2022-01-13 719/week @ 2022-01-20

2,347 downloads per month
Used in dfw

MIT license

18KB
412 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
~63K SLoC