utils

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package utils contains utility functions for firewalls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilterRuleWrapper

type FilterRuleWrapper struct {
	*firewallv1beta1.FilterRule
}

FilterRuleWrapper is a wrapper for a FilterRule.

func (*FilterRuleWrapper) Add

func (fr *FilterRuleWrapper) Add(nftconn *nftables.Conn, chain *nftables.Chain) error

Add adds the rule to the chain.

func (*FilterRuleWrapper) Equal

func (fr *FilterRuleWrapper) Equal(currentrule *nftables.Rule) bool

Equal checks if the rule is equal to the given one.

func (*FilterRuleWrapper) GetName

func (fr *FilterRuleWrapper) GetName() *string

GetName returns the name of the rule.

func (*FilterRuleWrapper) SetName

func (fr *FilterRuleWrapper) SetName(name string)

SetName sets the name of the rule.

type NatRuleWrapper

type NatRuleWrapper struct {
	*firewallv1beta1.NatRule
}

NatRuleWrapper wraps a NatRule.

func (*NatRuleWrapper) Add

func (nr *NatRuleWrapper) Add(nftconn *nftables.Conn, chain *nftables.Chain) error

Add adds the rule to the chain.

func (*NatRuleWrapper) Equal

func (nr *NatRuleWrapper) Equal(currentrule *nftables.Rule) bool

Equal checks if the rule is equal to the given one.

func (*NatRuleWrapper) GetName

func (nr *NatRuleWrapper) GetName() *string

GetName returns the name of the rule.

func (*NatRuleWrapper) SetName

func (nr *NatRuleWrapper) SetName(name string)

SetName sets the name of the rule.

type RouteRuleWrapper

type RouteRuleWrapper struct {
	*firewallv1beta1.RouteRule
}

RouteRuleWrapper is a wrapper for a RouteRule.

func (*RouteRuleWrapper) Add

Add adds the rule to the chain.

func (*RouteRuleWrapper) Equal

func (rr *RouteRuleWrapper) Equal(_ *nftables.Rule) bool

Equal checks if the rule is equal to the given one.

func (*RouteRuleWrapper) GetName

func (rr *RouteRuleWrapper) GetName() *string

GetName returns the name of the rule.

func (*RouteRuleWrapper) SetName

func (rr *RouteRuleWrapper) SetName(name string)

SetName sets the name of the rule.

type Rule

type Rule interface {
	GetName() *string
	SetName(string)
	Add(nftconn *nftables.Conn, chain *nftables.Chain) error
	Equal(rule *nftables.Rule) bool
}

Rule is a rule to be applied to a chain.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL