nftables

package
v0.30.3 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: BSD-3-Clause Imports: 27 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AclManager added in v0.24.4

type AclManager struct {
	// contains filtered or unexported fields
}

func (*AclManager) AddPeerFiltering added in v0.30.0

func (m *AclManager) AddPeerFiltering(
	ip net.IP,
	proto firewall.Protocol,
	sPort *firewall.Port,
	dPort *firewall.Port,
	direction firewall.RuleDirection,
	action firewall.Action,
	ipsetName string,
	comment string,
) ([]firewall.Rule, error)

AddPeerFiltering rule to the firewall

If comment argument is empty firewall manager should set rule ID as comment for the rule

func (*AclManager) DeletePeerRule added in v0.30.0

func (m *AclManager) DeletePeerRule(rule firewall.Rule) error

DeletePeerRule from the firewall by rule definition

func (*AclManager) Flush added in v0.24.4

func (m *AclManager) Flush() error

Flush rule/chain/set operations from the buffer

Method also get all rules after flush and refreshes handle values in the rulesets

type InterfaceState added in v0.30.3

type InterfaceState struct {
	NameStr       string          `json:"name"`
	WGAddress     iface.WGAddress `json:"wg_address"`
	UserspaceBind bool            `json:"userspace_bind"`
}

func (*InterfaceState) Address added in v0.30.3

func (i *InterfaceState) Address() device.WGAddress

func (*InterfaceState) IsUserspaceBind added in v0.30.3

func (i *InterfaceState) IsUserspaceBind() bool

func (*InterfaceState) Name added in v0.30.3

func (i *InterfaceState) Name() string

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager of iptables firewall

func Create

func Create(wgIface iFaceMapper) (*Manager, error)

Create nftables firewall manager

func (*Manager) AddNatRule added in v0.30.0

func (m *Manager) AddNatRule(pair firewall.RouterPair) error

func (*Manager) AddPeerFiltering added in v0.30.0

func (m *Manager) AddPeerFiltering(
	ip net.IP,
	proto firewall.Protocol,
	sPort *firewall.Port,
	dPort *firewall.Port,
	direction firewall.RuleDirection,
	action firewall.Action,
	ipsetName string,
	comment string,
) ([]firewall.Rule, error)

AddPeerFiltering rule to the firewall

If comment argument is empty firewall manager should set rule ID as comment for the rule

func (*Manager) AddRouteFiltering added in v0.30.0

func (m *Manager) AddRouteFiltering(sources []netip.Prefix, destination netip.Prefix, proto firewall.Protocol, sPort *firewall.Port, dPort *firewall.Port, action firewall.Action) (firewall.Rule, error)

func (*Manager) AllowNetbird added in v0.23.0

func (m *Manager) AllowNetbird() error

AllowNetbird allows netbird interface traffic

func (*Manager) DeletePeerRule added in v0.30.0

func (m *Manager) DeletePeerRule(rule firewall.Rule) error

DeletePeerRule from the firewall by rule definition

func (*Manager) DeleteRouteRule added in v0.30.0

func (m *Manager) DeleteRouteRule(rule firewall.Rule) error

DeleteRouteRule deletes a routing rule

func (*Manager) Flush added in v0.21.9

func (m *Manager) Flush() error

Flush rule/chain/set operations from the buffer

Method also get all rules after flush and refreshes handle values in the rulesets todo review this method usage

func (*Manager) Init added in v0.30.3

func (m *Manager) Init(stateManager *statemanager.Manager) error

Init nftables firewall manager

func (*Manager) IsServerRouteSupported added in v0.24.4

func (m *Manager) IsServerRouteSupported() bool

func (*Manager) RemoveNatRule added in v0.30.0

func (m *Manager) RemoveNatRule(pair firewall.RouterPair) error

func (*Manager) Reset

func (m *Manager) Reset(stateManager *statemanager.Manager) error

Reset firewall to the default state

func (*Manager) SetLegacyManagement added in v0.30.0

func (m *Manager) SetLegacyManagement(isLegacy bool) error

SetLegacyManagement sets the route manager to use legacy management

type Rule

type Rule struct {
	// contains filtered or unexported fields
}

Rule to handle management of rules

func (*Rule) GetRuleID

func (r *Rule) GetRuleID() string

GetRuleID returns the rule id

type ShutdownState added in v0.30.3

type ShutdownState struct {
	InterfaceState *InterfaceState `json:"interface_state,omitempty"`
}

func (*ShutdownState) Cleanup added in v0.30.3

func (s *ShutdownState) Cleanup() error

func (*ShutdownState) Name added in v0.30.3

func (s *ShutdownState) Name() string

Jump to

Keyboard shortcuts

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