firewall

package
v19.10.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

type Chain struct {
	Name   string
	Policy Policy.Enum
	Rules  []Rule
	// contains filtered or unexported fields
}

Chain ...

func (*Chain) Add

func (c *Chain) Add(rule Rule) *Chain

Add appends a rule at the end in the chain

func (*Chain) Insert

func (c *Chain) Insert(rule Rule) *Chain

Insert adds a rule at the beginning of the chain

func (*Chain) Remove

func (c *Chain) Remove(rule Rule) *Chain

Remove a rule from the chain

func (*Chain) RemoveIndex

func (c *Chain) RemoveIndex(idx uint) *Chain

RemoveIndex removes a rule by its index in the chain

type Firewall

type Firewall struct {
	// Tables contains all the tables of the Firewall
	Tables map[string]*Table
}

Firewall implements a Firewall based on iptables

func NewFirewall

func NewFirewall(ssh *system.SSHConfig) *Firewall

NewFirewall creates a new instance of Firewall and returns a pointer to it

func (*Firewall) FromSystem

func (fw *Firewall) FromSystem() error

FromSystem loads the current Firewall configuration from system

func (*Firewall) Table

func (fw *Firewall) Table(name string) (*Table, error)

Table returns the Table instance corresponding to table 'name'

func (*Firewall) ToSystem

func (fw *Firewall) ToSystem() error

ToSystem applies the firewall rules to the host

type Rule

type Rule struct {
	Action   Action.Enum
	Protocol string
	From     string
	FromPort string
	To       string
	ToPort   string
}

Rule defines a firewall rule

type Table

type Table struct {
	Name   string
	Chains map[string]*Chain
	// contains filtered or unexported fields
}

Table defines a table of the firewall

func (*Table) Chain

func (t *Table) Chain(name string) (*Chain, error)

Chain returns the chain named 'name'

func (*Table) NewChain

func (t *Table) NewChain(name string, policy Policy.Enum) *Chain

NewChain creates a new

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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