iptables

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const CommentPrefix = `NgingStatic`

Variables

View Source
var ModuleList = []string{`comment`, `string`, `time`, `connlimit`, `limit`}

Functions

func IsSupported added in v1.3.2

func IsSupported() bool

func LineCommentParser added in v1.3.2

func LineCommentParser(findComments []string) func(i uint64, t string) (rowInfo *cmdutils.RowInfo, err error)

func ResetCheck added in v1.3.2

func ResetCheck()

Types

type IPTables

type IPTables struct {
	IPProtocol driver.Protocol
	*iptables.IPTables
}

func New

func New(proto driver.Protocol, autoInstall bool) (*IPTables, error)

func (*IPTables) Append

func (a *IPTables) Append(rules ...driver.Rule) (err error)

func (*IPTables) AsWhitelist added in v1.3.2

func (a *IPTables) AsWhitelist(table, chain string) error

func (*IPTables) Delete

func (a *IPTables) Delete(rules ...driver.Rule) (err error)

func (*IPTables) Enabled

func (a *IPTables) Enabled(on bool) error

func (*IPTables) Exists

func (a *IPTables) Exists(rule driver.Rule) (bool, error)

func (*IPTables) Export

func (a *IPTables) Export(wfwFile string) error

func (*IPTables) Import

func (a *IPTables) Import(wfwFile string) error

func (*IPTables) Insert

func (a *IPTables) Insert(rules ...driver.Rule) (err error)

func (*IPTables) List

func (a *IPTables) List(table, chain string) ([]*driver.Rule, error)

func (*IPTables) Reset

func (a *IPTables) Reset() error

func (*IPTables) Stats added in v1.3.2

func (a *IPTables) Stats(table, chain string) ([]map[string]string, error)

func (*IPTables) Update added in v1.1.0

func (a *IPTables) Update(rule driver.Rule) error

Update update rulespec in specified table/chain

type ModuleComment added in v1.3.2

type ModuleComment struct {
	Comment string // 注释
}

func (*ModuleComment) Args added in v1.3.2

func (m *ModuleComment) Args() []string

func (*ModuleComment) ModuleStrings added in v1.3.2

func (m *ModuleComment) ModuleStrings() []string

func (*ModuleComment) String added in v1.3.2

func (m *ModuleComment) String() string

func (*ModuleComment) Strings added in v1.3.2

func (m *ModuleComment) Strings() []string

type ModuleConnLimit added in v1.3.2

type ModuleConnLimit struct {
	ConnLimitAbove uint64 // 单独使用此选项时,表示限制每个IP的链接数量。
	ConnLimitMask  uint16 // 此选项不能单独使用,在使用–connlimit-above选项时,配合此选项,则可以针对”某类IP段内的一定数量的IP”进行连接数量的限制。例如 24 或 27。
}

ModuleConnLimit 限制每个IP的最大连接数

func (*ModuleConnLimit) Args added in v1.3.2

func (m *ModuleConnLimit) Args() []string

func (*ModuleConnLimit) ModuleStrings added in v1.3.2

func (m *ModuleConnLimit) ModuleStrings() []string

func (*ModuleConnLimit) String added in v1.3.2

func (m *ModuleConnLimit) String() string

func (*ModuleConnLimit) Strings added in v1.3.2

func (m *ModuleConnLimit) Strings() []string

type ModuleLimit added in v1.3.2

type ModuleLimit struct {
	Limit uint64 // 指定令牌桶中生成新令牌的频率
	Unit  string // 时间单位 second、minute、hour、day
	Burst uint   // 指定令牌桶中令牌的最大数量
}

ModuleLimit 限制每个IP的最大发包数

func ParseLimits added in v1.3.2

func ParseLimits(rateStr string, burst uint) (*ModuleLimit, error)

ParseLimits parse ModuleLimit rateStr := `1+/bytes/second`

func (*ModuleLimit) Args added in v1.3.2

func (m *ModuleLimit) Args() []string

func (*ModuleLimit) ModuleStrings added in v1.3.2

func (m *ModuleLimit) ModuleStrings() []string

func (*ModuleLimit) String added in v1.3.2

func (m *ModuleLimit) String() string

func (*ModuleLimit) Strings added in v1.3.2

func (m *ModuleLimit) Strings() []string

type ModuleString added in v1.3.2

type ModuleString struct {
	Find string // 指定需要匹配的字符串。
	Algo string // 指定对应的匹配算法,可用算法为bm、kmp,此选项为必选项。
}

func (*ModuleString) Args added in v1.3.2

func (m *ModuleString) Args() []string

func (*ModuleString) ModuleStrings added in v1.3.2

func (m *ModuleString) ModuleStrings() []string

func (*ModuleString) String added in v1.3.2

func (m *ModuleString) String() string

func (*ModuleString) Strings added in v1.3.2

func (m *ModuleString) Strings() []string

type ModuleTime added in v1.3.2

type ModuleTime struct {
	Date      [2]string // 2006-01-02
	Time      [2]string // 15:04:05
	Weekdays  []uint    // 1-7
	Monthdays []uint    // 1-28/30/31
	KernelTZ  bool      // KernelTZ 为 false 的情况下,以上参数时间的时区为 UTC。否则为本地机器时区。
}

func (*ModuleTime) Args added in v1.3.2

func (m *ModuleTime) Args() []string

func (*ModuleTime) ModuleStrings added in v1.3.2

func (m *ModuleTime) ModuleStrings() []string

func (*ModuleTime) String added in v1.3.2

func (m *ModuleTime) String() string

func (*ModuleTime) Strings added in v1.3.2

func (m *ModuleTime) Strings() []string

type Moduler added in v1.3.2

type Moduler interface {
	Args() []string
	Strings() []string
	ModuleStrings() []string
	String() string
}

Jump to

Keyboard shortcuts

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