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.

toml [dependencies] iptables = "0.3"

Getting started

1- Import the crate iptables and manipulate chains:

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

asserteq!(ipt.newchain("nat", "NEWCHAINNAME").unwrap(), true); asserteq!(ipt.append("nat", "NEWCHAINNAME", "-j ACCEPT").unwrap(), true); asserteq!(ipt.exists("nat", "NEWCHAINNAME", "-j ACCEPT").unwrap(), true); asserteq!(ipt.delete("nat", "NEWCHAINNAME", "-j ACCEPT").unwrap(), true); asserteq!(ipt.delete_chain("nat", "NEWCHAINNAME").unwrap(), true); ```

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