[][src]Trait dfw::process::Process

pub trait Process<B: FirewallBackend> where
    DFW<B>: Process<B>, 
{ fn process(
        ctx: &ProcessContext<'_, B>
    ) -> Result<Option<Vec<B::Rule>>>; }

This trait allows a type to define its own processing rules. It is expected to return a list of rules that can be applied with nft.


struct MyBackend;
impl FirewallBackend for MyBackend {
    type Rule = String;

    fn apply(rules: Vec<String>, ctx: &ProcessContext<Self>) -> Result<(), Error> {
        // Write code to apply the processed rules.
struct MyType {
    rules: Vec<String>,

impl Process<MyBackend> for MyType {
    fn process(&self, ctx: &ProcessContext<MyBackend>) -> Result<Option<Vec<String>>, Error> {
        let mut rules = Vec::new();
        for rule in &self.rules {
            rules.push(format!("add rule {}", rule));

Required methods

fn process(&self, ctx: &ProcessContext<'_, B>) -> Result<Option<Vec<B::Rule>>>

Process the current type within the given ProcessContext, returning zero or more rules to apply with nft.

Loading content...

Implementations on Foreign Types

impl<B, T> Process<B> for Option<T> where
    B: FirewallBackend,
    DFW<B>: Process<B>,
    T: Process<B>, 

impl<B, T> Process<B> for Vec<T> where
    B: FirewallBackend,
    DFW<B>: Process<B>,
    T: Process<B>, 

Loading content...


impl Process<Iptables> for <Iptables as FirewallBackend>::Defaults[src]

impl Process<Iptables> for ContainerDNAT[src]

impl Process<Iptables> for ContainerDNATRule[src]

impl Process<Iptables> for ContainerToContainer[src]

impl Process<Iptables> for ContainerToContainerRule[src]

impl Process<Iptables> for ContainerToHost[src]

impl Process<Iptables> for ContainerToHostRule[src]

impl Process<Iptables> for ContainerToWiderWorld[src]

impl Process<Iptables> for ContainerToWiderWorldRule[src]

impl Process<Iptables> for DFW<Iptables>[src]

impl Process<Iptables> for GlobalDefaults[src]

impl Process<Iptables> for WiderWorldToContainer[src]

impl Process<Iptables> for WiderWorldToContainerRule[src]

impl Process<Nftables> for <Nftables as FirewallBackend>::Defaults[src]

impl Process<Nftables> for ContainerDNAT[src]

impl Process<Nftables> for ContainerDNATRule[src]

impl Process<Nftables> for ContainerToContainer[src]

impl Process<Nftables> for ContainerToContainerRule[src]

impl Process<Nftables> for ContainerToHost[src]

impl Process<Nftables> for ContainerToHostRule[src]

impl Process<Nftables> for ContainerToWiderWorld[src]

impl Process<Nftables> for ContainerToWiderWorldRule[src]

impl Process<Nftables> for DFW<Nftables>[src]

impl Process<Nftables> for GlobalDefaults[src]

impl Process<Nftables> for WiderWorldToContainer[src]

impl Process<Nftables> for WiderWorldToContainerRule[src]

Loading content...