portmapper

package
v0.6.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2016 License: Apache-2.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnknownBackendAddressType refers to an unknown container or unsupported address type
	ErrUnknownBackendAddressType = errors.New("unknown container address type not supported")
	// ErrPortMappedForIP refers to a port already mapped to an ip address
	ErrPortMappedForIP = errors.New("port is already mapped to ip")
	// ErrPortNotMapped refers to an unmapped port
	ErrPortNotMapped = errors.New("port is not mapped")
)

Functions

This section is empty.

Types

type PortMapper

type PortMapper struct {
	Allocator *portallocator.PortAllocator
	// contains filtered or unexported fields
}

PortMapper manages the network address translation

func New

func New() *PortMapper

New returns a new instance of PortMapper

func NewWithPortAllocator

func NewWithPortAllocator(allocator *portallocator.PortAllocator) *PortMapper

NewWithPortAllocator returns a new instance of PortMapper which will use the specified PortAllocator

func (*PortMapper) Map

func (pm *PortMapper) Map(container net.Addr, hostIP net.IP, hostPort int, useProxy bool) (host net.Addr, err error)

Map maps the specified container transport address to the host's network address and transport port

func (*PortMapper) MapRange

func (pm *PortMapper) MapRange(container net.Addr, hostIP net.IP, hostPortStart, hostPortEnd int, useProxy bool) (host net.Addr, err error)

MapRange maps the specified container transport address to the host's network address and transport port range

func (*PortMapper) ReMapAll

func (pm *PortMapper) ReMapAll()

ReMapAll will re-apply all port mappings

func (*PortMapper) SetIptablesChain

func (pm *PortMapper) SetIptablesChain(c *iptables.ChainInfo, bridgeName string)

SetIptablesChain sets the specified chain into portmapper

func (*PortMapper) Unmap

func (pm *PortMapper) Unmap(host net.Addr) error

Unmap removes stored mapping for the specified host transport address

Jump to

Keyboard shortcuts

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