firewall

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2019 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 FirewallBackend

type FirewallBackend interface {
	Add(*FirewallNetConf) error
	Del(*FirewallNetConf) error
}

FirewallBackend is an interface to the system firewall, allowing addition and removal of firewall rules. Nolint applied for firewall.Firewall... name duplication notice. nolint

func GetBackend

func GetBackend(backend string) (FirewallBackend, error)

GetBackend retrieves a firewall backend for adding or removing firewall rules on the system. Valid backend names are firewalld, iptables, and none. If the empty string is given, a firewalld backend will be returned if firewalld is running, and an iptables backend will be returned otherwise.

type FirewallNetConf

type FirewallNetConf struct {

	// IptablesAdminChainName is an optional name to use instead of the default
	// admin rules override chain name that includes the interface name.
	IptablesAdminChainName string

	// FirewalldZone is an optional firewalld zone to place the interface into.  If
	// the firewalld backend is used but the zone is not given, it defaults
	// to 'trusted'
	FirewalldZone string

	PrevResult *current.Result
}

FirewallNetConf represents the firewall configuration. Nolint applied for firewall.Firewall... name duplication notice. nolint

type FirewallNone

type FirewallNone struct{}

FirewallNone is a firewall backend for environments where manipulating the system firewall is unsupported (for example, when running without root). Nolint applied to avoid firewall.FirewallNone name duplication notes. nolint

func (*FirewallNone) Add

func (f *FirewallNone) Add(conf *FirewallNetConf) error

Add adds a rule to the system firewall. No action is taken and an error is unconditionally returned as this backend does not support manipulating the firewall.

func (*FirewallNone) Del

func (f *FirewallNone) Del(conf *FirewallNetConf) error

Del deletes a rule from the system firewall. No action is taken and an error is unconditionally returned as this backend does not support manipulating the firewall.

Jump to

Keyboard shortcuts

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