Add Version method to NFT interface and implementation

Include `RunWithOutput` support in the command package and introduce version parsing logic, enabling retrieval of the nftables version and options.
This commit is contained in:
2025-10-20 22:44:40 +05:00
parent c3a513f92c
commit 9210448f16
3 changed files with 83 additions and 0 deletions

21
version.go Normal file
View File

@@ -0,0 +1,21 @@
package nft
type Version interface {
// Version returns the version of the nftables client.
Version() string
// Opts returns the options of the nftables client.
Opts() map[string]string
}
type version struct {
version string
opts map[string]string
}
func (v version) Version() string {
return v.version
}
func (v version) Opts() map[string]string {
return v.opts
}