iptables

package
v1.1.0-alpha.0....-8bd9592 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2015 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IPTABLES_MIN_VERSION string = "1.4.0"
)

NOTE: IPTABLES_MIN_VERSION is the minimum version of iptables for which we will use the Proxier from this package instead of the userspace Proxier. This is will not be enough, as the version number is somewhat unreliable, features are backported in various distros and this could get pretty hairy. However iptables-1.4.0 was released 2007-Dec-22 and appears to have every feature we use, so this seems prefectly reasonable for now.

Variables

This section is empty.

Functions

func ShouldUseIptablesProxier

func ShouldUseIptablesProxier() (bool, error)

ShouldUseIptablesProxier returns true if we should use the iptables Proxier instead of the userspace Proxier. This is determined by the iptables version. It may return an erorr if it fails to get the itpables version without error, in which case it will also return false.

Types

type Proxier

type Proxier struct {
	// contains filtered or unexported fields
}

Proxier is an iptables based proxy for connections between a localhost:lport and services that provide the actual backends.

func NewProxier

func NewProxier(ipt utiliptables.Interface, syncPeriod time.Duration) (*Proxier, error)

NewProxier returns a new Proxier given an iptables Interface instance. Because of the iptables logic, it is assumed that there is only a single Proxier active on a machine. An error will be returned if iptables fails to update or acquire the initial lock. Once a proxier is created, it will keep iptables up to date in the background and will not terminate if a particular iptables call fails.

func (*Proxier) OnEndpointsUpdate

func (proxier *Proxier) OnEndpointsUpdate(allEndpoints []api.Endpoints)

OnEndpointsUpdate takes in a slice of updated endpoints.

func (*Proxier) OnServiceUpdate

func (proxier *Proxier) OnServiceUpdate(allServices []api.Service)

OnServiceUpdate tracks the active set of service proxies. They will be synchronized using syncProxyRules()

func (*Proxier) SyncLoop

func (proxier *Proxier) SyncLoop()

SyncLoop runs periodic work. This is expected to run as a goroutine or as the main loop of the app. It does not return.

Jump to

Keyboard shortcuts

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