iptablesmanager

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: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OutputChainName = "OUTPUT"
	InputChainName  = "INPUT"
)

Variables

View Source
var ErrIptablesFailure = errors.New("iptables failure")

Functions

This section is empty.

Types

type CommandRunnerMock

type CommandRunnerMock struct {
	ErrCommand string
	// contains filtered or unexported fields
}

func NewCommandRunnerMock

func NewCommandRunnerMock() CommandRunnerMock

func NewCommandRunnerMockWithTables

func NewCommandRunnerMockWithTables() CommandRunnerMock

NewCommandRunnerMockWithTables returns CommandRunnerMock where outputs are configured to return first two lines of iptables output, i.e:

Chain INPUC (policy ACCEPT)

target prot opt source destination

For OUTPUT and INPUT table.

func (*CommandRunnerMock) AddIptablesListOutput

func (i *CommandRunnerMock) AddIptablesListOutput(chain string, output string)

func (*CommandRunnerMock) PopIPv4Commands

func (i *CommandRunnerMock) PopIPv4Commands() []string

func (*CommandRunnerMock) PopIPv6Commands

func (i *CommandRunnerMock) PopIPv6Commands() []string

func (*CommandRunnerMock) RunCommand

func (i *CommandRunnerMock) RunCommand(command string, args string) (string, error)

type IptablesOutput

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

func NewIptablesOutput

func NewIptablesOutput(chain string) IptablesOutput

func (*IptablesOutput) AddRules

func (i *IptablesOutput) AddRules(rules ...string)

func (*IptablesOutput) Get

func (i *IptablesOutput) Get() string

Jump to

Keyboard shortcuts

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