Expand description
Convenience helpers for assembling firewall objects in “builder” style.
This module targets interactive or prototyping flows where developers want to express
object definitions with as little boilerplate as possible. Helper functions turn dotted
notation such as address("app1", "192.0.2.10") or service::tcp(443) into strongly
typed objects that can be inserted into an ObjectStore.
use firewall_objects::builder::{address, service, service_group};
use firewall_objects::objects::ObjectStore;
let mut store = ObjectStore::new();
for entry in [
address("server1", "192.168.50.10").unwrap(),
address("Public DMZ", "10.10.105.0/24").unwrap(),
] {
store.add(entry).unwrap();
}
let allowed_services = service_group("allowed services")
.unwrap()
.with_service(service::tcp(443))
.unwrap()
.with_service(service::udp(53))
.unwrap()
.build()
.unwrap();
store.add(allowed_services).unwrap();
assert!(store.network("server1").is_ok());
assert!(store.service_group("allowed services").is_ok());Modules§
- service
- Convenience namespace for transport builders:
service::tcp(443)orservice::parse("udp/53").
Structs§
- Application
Builder - Builder for application objects with minimal ceremony.
- Network
Group Builder - Builder helper for adding multiple network objects into the same group.
- Service
Group Builder - Builder helper for constructing service groups through chained calls.
Enums§
- Builder
Entry - Unified wrapper returned by the builders so
ObjectStore::addcan accept any object or builder directly.
Traits§
- Into
Network Obj - Network helper trait implemented for both raw objects and builder entries.
- Into
Service Obj - Service helper trait implemented for both raw objects and builder entries.
Functions§
- address
- Helper that builds a
NetworkObjfrom a human-friendly input. Thenameis optional—pass an empty string to default to the normalized value. - application
- Begin composing an application object.
- network_
group - Start a network group builder with the provided
name. - service_
group - Start a service group builder with the provided
name.