Re: [pve-devel] [PATCH proxmox-firewall 09/37] config: firewall: add types for rules

2024-04-09 Thread Lukas Wagner
On 2024-04-03 12:46, Max Carrara wrote: >> + >> +#[derive(Clone, Debug)] >> +#[cfg_attr(test, derive(Eq, PartialEq))] >> +pub enum IcmpType { >> +Numeric(u8), >> +Named(&'static str), >> +} >> + >> +// MUST BE SORTED! > > Should maaaybe note that it must be sorted for binary search, not

Re: [pve-devel] [PATCH proxmox-firewall 09/37] config: firewall: add types for rules

2024-04-09 Thread Stefan Hanreich
On 4/3/24 12:46, Max Carrara wrote: > Hmm, since this is only used below, IMO it's fine that this returns a > tuple like that on `Ok` - but should functions like that be used in > multiple places, it might be beneficial to use a type alias or even a > tuple struct for readability's sake. Yes, I fi

Re: [pve-devel] [PATCH proxmox-firewall 09/37] config: firewall: add types for rules

2024-04-03 Thread Max Carrara
On Tue Apr 2, 2024 at 7:16 PM CEST, Stefan Hanreich wrote: > Additionally we implement FromStr for all rule types and parts, which > can be used for parsing firewall config rules. Initial rule parsing > works by parsing the different options into a HashMap and only then > de-serializing a struct fr

[pve-devel] [PATCH proxmox-firewall 09/37] config: firewall: add types for rules

2024-04-02 Thread Stefan Hanreich
Additionally we implement FromStr for all rule types and parts, which can be used for parsing firewall config rules. Initial rule parsing works by parsing the different options into a HashMap and only then de-serializing a struct from the parsed options. This intermediate step makes rule parsing a