rules

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RuleSet

type RuleSet struct {
	//Rules []iptables.Rule `yaml:"rules"`
	Rules map[string]iptables.Rule `yaml:"rules"`
}

RulesFile keep track of listed rules the result looks like so: rules:

  • iface: eth0 proto: tcp dport: 3000 saddr: 192.168.122.43 sport: 22
  • iface: eth0 ...

func NewRuleSet

func NewRuleSet() *RuleSet

func NewRuleSetFromFile

func NewRuleSetFromFile(file io.Reader) (*RuleSet, error)

NewRuleSet return the struct that contains informations about rules

func (*RuleSet) Add

func (rs *RuleSet) Add(rule iptables.Rule)

func (*RuleSet) GetHash

func (rs *RuleSet) GetHash(rule iptables.Rule) string

func (*RuleSet) Remove

func (rs *RuleSet) Remove(ruleHash string)

type RuleSetDiff added in v0.9.1

type RuleSetDiff struct {
	ToRemove []*iptables.Rule
	ToAdd    []*iptables.Rule
}

func Diff added in v0.9.1

func Diff(oldRS, newRS *RuleSet) *RuleSetDiff

Diff method returns a *RuleSetDiff struct. It contains a list of Rule(s) to be added / remove in order to achieve the new RuleSet state.

Jump to

Keyboard shortcuts

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