NewIptables

package
v0.0.0-...-7685a06 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: GPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ACCEPT   = "ACCEPT"
	DROP     = "DROP"
	RETURN   = "RETURN"
	QUEUE    = "QUEUE"
	REDIRECT = "REDIRECT"
	TPROXY   = "TPROXY"
	MARK     = "MARK"
)

action

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseRule

type BaseRule struct {
	Not   bool   // !
	Match string // -s
	Param string // 1111.2222.3333.4444
}

base rule

func (*BaseRule) String

func (bs *BaseRule) String() string

make string -s 1111.2222.3333.4444

type Chain

type Chain struct {
	// chain name
	Name string // PREROUTING,INPUT,FORWARD,OUTPUT,POSTROUTING or self define chain
	// contains filtered or unexported fields
}

chain

func (*Chain) AddRule

func (c *Chain) AddRule(cpl *CompleteRule) error

add rule

func (*Chain) AppendRule

func (c *Chain) AppendRule(cpl *CompleteRule) error

append rule at last

func (*Chain) Clear

func (c *Chain) Clear() error

clear all chain

func (*Chain) CreateChild

func (c *Chain) CreateChild(name string, index int, cpl *CompleteRule) (*Chain, error)

create child chain

func (*Chain) DelChild

func (c *Chain) DelChild(child *Chain) error

delete child from self

func (*Chain) DelRule

func (c *Chain) DelRule(cpl *CompleteRule) error

del rule

func (*Chain) DelRuleByIndex

func (c *Chain) DelRuleByIndex(index int) error

del rule index

func (*Chain) ExistRule

func (c *Chain) ExistRule(cpl *CompleteRule) bool

check if rule exist

func (*Chain) GetChildrenCount

func (c *Chain) GetChildrenCount() int

current children chain

func (*Chain) GetCreateChildIndex

func (c *Chain) GetCreateChildIndex(name string) (int, bool)

current create child index

func (*Chain) GetRuleByIndex

func (c *Chain) GetRuleByIndex(index int) *CompleteRule

get rule index

func (*Chain) GetRulesCount

func (c *Chain) GetRulesCount() int

current rule count

func (*Chain) InsertRule

func (c *Chain) InsertRule(index int, cpl *CompleteRule) error

insert rule

func (*Chain) Remove

func (c *Chain) Remove() error

remove self

type CompleteRule

type CompleteRule struct {
	Action    string
	BaseSl    []BaseRule
	ExtendsSl []ExtendsRule
}

one complete rule

func (*CompleteRule) String

func (cpl *CompleteRule) String() string

make string -j ACCEPT -s 1111.2222.3333.4444 -m mark --mark 1

type ExtendsElem

type ExtendsElem struct {
	Match string   // mark
	Base  BaseRule // --mark 1
}

extends elem

func (*ExtendsElem) String

func (elem *ExtendsElem) String() string

make string mark --mark 1

type ExtendsRule

type ExtendsRule struct {
	Match string      // -m
	Elem  ExtendsElem // mark --mark 1
}

extends rule

func (*ExtendsRule) String

func (ex *ExtendsRule) String() string

make string -m mark --mark 1

type Manager

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

func NewManager

func NewManager() *Manager

create manager

func (*Manager) GetChain

func (m *Manager) GetChain(tName string, cName string) *Chain

get chain, usually use to get default chain

func (*Manager) Init

func (m *Manager) Init()

init table

type Operation

type Operation int

define operation

const (
	Append Operation = iota
	Insert
	New
	Delete
	Remove
	Policy
	Flush
)

func (Operation) ToString

func (a Operation) ToString() string

type Table

type Table struct {
	Name string // raw mangle nat filter
	// contains filtered or unexported fields
}

tables

Jump to

Keyboard shortcuts

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