nftables
nftables copied to clipboard
feature: Rule methods
@stapelberg, @sbezverk and other maintainers, currently many module's structs have no methods of their own. For example, it would have been nice to have String()
method for Rule
.
Is it OK to submit a PR for this?
Regarding the String()
method, just to double-check: it would return a human-readable representation of the rule, and wouldn’t be used programmatically, yes? If so, that seems okay to me.
Regarding the String() method, just to double-check: it would return a human-readable representation of the rule, and wouldn’t be used programmatically, yes?
@stapelberg , Yes. I want to be able to see one liner rule, similar to “nft” utility. Today, it takes an “essay” to get a gist of what a rule does! 😄 i am not complaining ... i appreciate the complexity ... i learned from the experience ... however, it would probably make the library easier to consume. In fact, back in March, i failed to use the library because of its use complexity. Then, I stumbled upon a few blog posts and had an epiphany :-)
It is just Rule does not have any method ... For example ... ‘IsVerdictDrop’, ‘IsVerdictJump’, ‘IsIPv4’, ‘IsIPv6’, etc.
Sure, in that case adding String() makes sense.
For the other methods, I’m tentatively in favor, but let’s discuss those over a pull request maybe?
In general, this library is pretty low-level, so I don’t want to add too much syntactic sugar.
For the other methods, I’m tentatively in favor, but let’s discuss those over a pull request maybe?
@stapelberg , absolutely!
In general, this library is pretty low-level, so I don’t want to add too much syntactic sugar.
👍