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.4"
1- Import the crate iptables
and manipulate chains:
```rust let ipt = iptables::new(false).unwrap();
assert!(ipt.newchain("nat", "NEWCHAINNAME").isok()); assert!(ipt.append("nat", "NEWCHAINNAME", "-j ACCEPT").isok()); assert!(ipt.exists("nat", "NEWCHAINNAME", "-j ACCEPT").unwrap()); assert!(ipt.delete("nat", "NEWCHAINNAME", "-j ACCEPT").isok()); assert!(ipt.deletechain("nat", "NEWCHAINNAME").isok()); ```
For more information, please check the test file in tests
folder.