Expand description
Provides bindings for iptables application in Linux. 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.
§Example
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());
Modules§
Structs§
- IPTables
- Contains the iptables command and shows if it supports -w and -C options.
Use
new
method to create a new instance of this struct.
Functions§
- new
- Creates a new
IPTables
Result with the command of ‘iptables’ ifis_ipv6
isfalse
, otherwise the command is ‘ip6tables’.