forwarder

package
v0.0.0-...-aa2490a Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package forwarder manages the FORWARD chain rules(meshnet and allowlist).

Index

Constants

View Source
const (
	Ipv4fwdKernelParamName = "net.ipv4.ip_forward"
)

Variables

View Source
var (
	REMOVE operation = false
	ADD    operation = true
)

Used when adding or removing rules from firewall

Functions

This section is empty.

Types

type ForwardChainManager

type ForwardChainManager interface {
	Enable() error
	ResetPeers(peers mesh.MachinePeers,
		lanAvailable bool,
		killswitch bool,
		enableAllowlist bool,
		allowlist config.Allowlist) error
	ResetFirewall(lanAvailable bool, killswitch bool, enableAllowlist bool, allowlist config.Allowlist) error
	Disable() error
}

ForwardChainManager is responsible for managing rules in the FORWARD chain of iptables

type Forwarder

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

Forwarder manages the FORWARD chain in iptables

func NewForwarder

func NewForwarder(interfaceNames []string, commandFunc runCommandFunc, sysctlSetter kernel.SysctlSetter) *Forwarder

NewForwarder create & initialize new Server

func (*Forwarder) Disable

func (en *Forwarder) Disable() error

Disable removes meshnet related rules from the FORWARD and NAT chains.

func (*Forwarder) Enable

func (en *Forwarder) Enable() error

Enable adds meshnet related rules to the FORWARD chain.

func (*Forwarder) ResetFirewall

func (en *Forwarder) ResetFirewall(lanAvailable bool,
	killswitch bool,
	enableAllowlist bool,
	allowlist config.Allowlist) error

ResetFirewall resets forwarding rules using the stored peer list. If meshnet is not enabled, only allowlist related rules will be affected.

func (*Forwarder) ResetPeers

func (en *Forwarder) ResetPeers(peers mesh.MachinePeers,
	lanAvailable bool,
	killswitch bool,
	enableAllowlist bool,
	allowlist config.Allowlist) error

ResetPeers resets forwarding rules to respect settings in the provided peer list.

type TrafficPeer

type TrafficPeer struct {
	IP           netip.Prefix
	Routing      bool
	LocalNetwork bool
}

Jump to

Keyboard shortcuts

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