rules

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2023 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(path string) (*RuleSet, error)

NewRuleSet return the struct that contains informations about rules

func (*RuleSet) Add

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

func (*RuleSet) Diff

func (rs *RuleSet) Diff(oldRS *RuleSet) error

Diff add and remove rules based on the differences between the old and current rules set. Return an error in case of fail, nil otherwise.

func (*RuleSet) GetHash

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

func (*RuleSet) Remove

func (rs *RuleSet) Remove(ruleHash string)

Jump to

Keyboard shortcuts

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