iptables

Crates.ioiptables
lib.rsiptables
version0.5.2
sourcesrc
created_at2017-02-11 11:11:54.595352
updated_at2024-06-06 13:20:30.58518
descriptionRust bindings for iptables
homepagehttps://github.com/yaa110/rust-iptables
repositoryhttps://github.com/yaa110/rust-iptables
max_upload_size
id8465
size26,979
embedded-nal (github:rust-embedded-community:embedded-nal)

documentation

https://github.com/yaa110/rust-iptables

README

Rust iptables

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

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.

Commit count: 27

cargo fmt