iptables

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplierCleaner

type ApplierCleaner interface {
	// Apply will create custom chains and insert rules
	Apply() error
	// Remove flush rules of all custom chains and remove them all
	Remove() error
	// Flush rules of all custom chains
	Flush() error
}

ApplierCleaner is used to apply or clean custom chains and rules

func NewApplierCleaner

func NewApplierCleaner(protocol Protocol, chains []JumpChain, rulesData []byte) ApplierCleaner

type Chain

type Chain = utiliptables.Chain
const (
	ChainInput       Chain = "INPUT"
	ChainForward     Chain = "FORWARD"
	ChainPostRouting Chain = "POSTROUTING"
)
const (
	ChainFabEdgeInput       Chain = "FABEDGE-INPUT"
	ChainFabEdgeForward     Chain = "FABEDGE-FORWARD"
	ChainFabEdgePostRouting Chain = "FABEDGE-POSTROUTING"
)

type FlushFlag

type FlushFlag = utiliptables.FlushFlag
const (
	// FlushTables a boolean true constant for option flag FlushFlag
	FlushTables FlushFlag = true

	// NoFlushTables a boolean false constant for option flag FlushFlag
	NoFlushTables FlushFlag = false
)

type Interface

type Interface interface {
	utiliptables.Interface
	// CreateChains create custom chains and insert them in specified positions
	CreateChains(chains []JumpChain) error
	// SafeFlushChain flush rules of all custom chains, it won't return error if chain doesn't exist
	SafeFlushChain(table Table, chain Chain) error
	// FlushChains flush rules of all custom chains
	FlushChains(chains []JumpChain) error
	// DeleteChains flush rules of all custom chains and remove them all
	DeleteChains(chains []JumpChain) error
	// SafeDeleteChain flush rules of specified chain from specified table and delete the chain,
	// it won't return error if chain doesn't exist
	SafeDeleteChain(chain JumpChain) error
	// NewApplierCleaner create a ApplierCleaner with specified custom chains and rules
	NewApplierCleaner(chains []JumpChain, rulesData []byte) ApplierCleaner
}

func NewIPTablesHelper

func NewIPTablesHelper(protocol Protocol) Interface

type JumpChain

type JumpChain struct {
	Table    Table
	SrcChain Chain
	DstChain Chain
	Position RulePosition
}

type Protocol

type Protocol = utiliptables.Protocol
const (
	ProtocolIPv4 Protocol = "IPv4"
	ProtocolIPv6 Protocol = "IPv6"
)

type RestoreCountersFlag

type RestoreCountersFlag = utiliptables.RestoreCountersFlag

RestoreCountersFlag is an option flag for Restore

const (
	RestoreCounters   RestoreCountersFlag = true
	NoRestoreCounters RestoreCountersFlag = false
)

type Table

type Table = utiliptables.Table
const (
	TableFilter Table = "filter"
	TableNat    Table = "nat"
)

Jump to

Keyboard shortcuts

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