### Adding riptables Dependency (TOML) Source: https://github.com/fewensa/riptables/blob/master/README.md This TOML snippet demonstrates how to add the `riptables` crate as a dependency to your Rust project's `Cargo.toml` file. Specifying `riptables = "0.1"` ensures that version 0.1 of the library is included, allowing you to use its functionalities. ```TOML [dependencies] riptables = "0.1" ``` -------------------------------- ### Testing iptables Chain Operations (Rust) Source: https://github.com/fewensa/riptables/blob/master/README.md This Rust test function demonstrates the core functionalities of the `riptables` library, including creating a new iptables chain, inserting a rule, listing rules within a chain, and then deleting the rule and the chain. It verifies that the operations are successful and that the listed rules match expected properties like table, chain, and origin. ```Rust use riptables::RIPTables; use riptables::rule::Archive; #[test] fn test_list() { let table = "nat"; let name = "TESTNAT"; let iptables = riptables::new(false).unwrap(); iptables.new_chain(table, name); iptables.insert(table, name, "-j ACCEPT", 1); let rules = iptables.list_chains(table, name).unwrap(); iptables.delete(table, name, "-j ACCEPT"); iptables.delete_chain(table, name); assert_eq!(rules.len(), 2); for rule in rules { println!("{:?}", rule); assert_eq!(rule.table, "nat".to_string()); assert_eq!(rule.chain, name.to_string()); match rule.archive { Archive::NewChain => assert_eq!(rule.origin, "-N TESTNAT".to_string()), Archive::Append => assert_eq!(rule.origin, "-A TESTNAT -j ACCEPT".to_string()), _ => {} } } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.