fw

package
v0.0.0-...-5b8b77a Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FirebuildIptFilterChainNameEnvVarName is the name of the environment variable which can be used
	// to override the default firebuild filter chain name.
	FirebuildIptFilterChainNameEnvVarName = "FIREBUILD_IPT_FILTER_CHAIN_NAME"
	// FirebuildIptDefaultFilterChainName is the default firebuild filer chain name.
	FirebuildIptDefaultFilterChainName = "FIREBUILD-FILTER"

	// FirebuildFlockDefaultFile is the default IPT flock path.
	FirebuildFlockDefaultFile = "/tmp/iptables.lock"
	// FirebuildFlockFileEnvVarName is the name of the environment variable which can be used to
	// override the default flock file path.
	FirebuildFlockFileEnvVarName = "FIREBUILD_IPT_FLOCK_FILE"

	// FirebuildFlockDefaultAcquireTimeout is the default timeout value.
	FirebuildFlockDefaultAcquireTimeout = "10s"
	// FirebuildFlockAcquireTimeoutEnvVarName is the name of the environment variable which can be used to
	// override the default flock acquire timeout.
	FirebuildFlockAcquireTimeoutEnvVarName = "FIREBUILD_IPT_FLOCK_ACQUIRE_TIMEOUT"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ExposedPort

type ExposedPort interface {
	Interface() *string
	HostPort() int
	DestinationPort() int
	Protocol() string

	ToForwardRulespec(targetAddress string) []string
	ToNATRulespec(targetAddress string) []string
}

ExposedPort represents exposed port data used for iptables port publishing.

func ExposedPortFromString

func ExposedPortFromString(input string) (ExposedPort, error)

ExposedPortFromString attempts to parse the input as an exposed port.

type IPTManager

type IPTManager interface {
	// Publish publishes exposed ports. Creates a nat table chain if necessary.
	Publish([]ExposedPort) error
	// Unpublish removes exposed ports. Removes the nat table chain if necessary.
	Unpublish([]ExposedPort) error
}

IPTManager manages filter and nat rules for VM exposed ports.

func NewManager

func NewManager(vmID, ipAddress string) (IPTManager, error)

NewManager returns a publisher with configured firebuild filter chain in the filter table. If chain fails to initialize, returns an error. Locking happens in: - ensureFilterChain, called only when creating new manager - in Publish - in Unpublish

Jump to

Keyboard shortcuts

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