Files
moby/daemon/libnetwork/internal/nftables/fluentapi_linux.go
Sebastiaan van Stijn 126e9c13de d/libn/i/nftables: fix ST1016 (staticcheck)
Looks like the linter didn't detect this in de71462b97

    daemon/libnetwork/internal/nftables/fluentapi_linux.go:8:20: ST1016: methods on the same type should have the same receiver name (seen 1x "b", 2x "cd") (staticcheck)
    func (b BaseChain) Builder() chainBuilder {
                       ^
    daemon/libnetwork/internal/nftables/fluentapi_linux.go:14:16: ST1016: methods on the same type should have the same receiver name (seen 1x "c", 2x "cd") (staticcheck)
    func (c Chain) Builder() chainBuilder {
                   ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-07-02 23:09:09 +02:00

31 lines
553 B
Go

package nftables
type chainBuilder struct {
chain string
tm *Modifier
}
func (cd BaseChain) Builder() chainBuilder {
tm := &Modifier{}
tm.create(cd, 1)
return chainBuilder{chain: cd.Name, tm: tm}
}
func (cd Chain) Builder() chainBuilder {
tm := &Modifier{}
tm.create(cd, 1)
return chainBuilder{chain: cd.Name, tm: tm}
}
func (b chainBuilder) Rule(rule ...string) chainBuilder {
b.tm.create(Rule{
Chain: b.chain,
Rule: rule,
}, 1)
return b
}
func (b chainBuilder) Create(tm *Modifier) {
tm.cmds = append(tm.cmds, b.tm.cmds...)
}