utils

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package utils contains utility functions for firewalls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIPValueRange added in v1.1.0

func GetIPValueRange(s string) (address1, address2 net.IP, err error)

GetIPValueRange parses the match value and returns the range of IPs.

func GetIPValueType added in v1.0.1

func GetIPValueType(value *string) (firewallv1beta1.IPValueType, error)

GetIPValueType parses the match value and returns the type of the value.

func GetIPValueTypeRange added in v1.1.0

func GetIPValueTypeRange(s string) (firewallv1beta1.IPValueType, error)

GetIPValueTypeRange parses the match value and returns the type of the value.

func GetPortValueType added in v1.0.1

func GetPortValueType(value *string) (firewallv1beta1.PortValueType, error)

GetPortValueType parses the match value and returns the type of the value.

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