A Rust crate for managing Windows Firewall rules and settings using the Windows API in Rust.
Features
- Create, modify, and delete firewall rules
- Check firewall status and active profiles
- Manage incoming and outgoing rules
- Full control over rule properties:
- Ports and protocols
- Applications and services
- Network interfaces
- IP addresses
- ICMP settings
- Edge traversal
- Security profiles
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Usage Examples
Creating and Managing Rules
use ;
// Create a new rule
let mut rule = builder
.name
.action
.direction
.enabled
.description
.protocol
.local_ports
.build;
// Add the rule
match add_rule ;
// Verify the rule exists
match rule_exists ;
let updated_settings = builder
.enabled
.description
.build;
// Update the rule
match update_rule ;
// Remove the rule
match remove_rule ;
Another example of using struct methods
use ;
// Create a new firewall rule
let mut rule = builder
.name
.action
.direction
.enabled
.description
.protocol
.local_ports
.build;
// Add the rule
match rule.add ;
// Verify the rule exists
match rule.exists ;
let updated_settings = builder
.enabled
.description
.build;
// Update the rule
match rule.update ;
// Remove the rule
match rule.remove ;
Checking Firewall Status
use ;
match get_firewall_state
Listing Firewall Rules
use list_rules;
match list_rules
Requirements
- Windows 7 or later
- Administrative privileges for certain operations
Support
For issues and questions:
- Open an issue on GitHub
- Check the documentation
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.