Popularity
2.3
Declining
Activity
0.0
Stable
28
5
9

Monthly Downloads: 244
Programming language: Rust
License: MIT License
Tags: Linux     Bindings     Platform specific     Iptables     Netfilter    
Latest version: v0.2.2

rust-iptables alternatives and similar packages

Based on the "Linux" category

Do you think we are missing an alternative of rust-iptables or a related project?

Add another 'Linux' Package

README

Rust iptables

crates.io Documentation Build Status License

Rust iptables v0.2.2 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.

Installation

The minimum required Rust version is 1.13.0 which supports ? operator. Add iptables = "0.2" to dependencies section of Cargo.toml:

[dependencies]
iptables = "0.2"

Getting started

1- Import the crate iptables and manipulate chains:

extern crate iptables;

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

assert_eq!(ipt.new_chain("nat", "NEWCHAINNAME").unwrap(), true);
assert_eq!(ipt.append("nat", "NEWCHAINNAME", "-j ACCEPT").unwrap(), true);
assert_eq!(ipt.exists("nat", "NEWCHAINNAME", "-j ACCEPT").unwrap(), true);
assert_eq!(ipt.delete("nat", "NEWCHAINNAME", "-j ACCEPT").unwrap(), true);
assert_eq!(ipt.delete_chain("nat", "NEWCHAINNAME").unwrap(), true);

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


*Note that all licence references and agreements mentioned in the rust-iptables README section above are relevant to that project's source code only.