portmapping

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PortMapper = portmapper.New()
)

Functions

func Modprobe

func Modprobe(module string) error

func ReleasePortMaps

func ReleasePortMaps(containerip string, externalPrefix []string, maps []*PortMapping) (postExec [][]string, err error)

func Setup

func Setup(bIface, addr string, disable bool) error

setup environment for iptables and IP forwarding

func SetupPortMaps

func SetupPortMaps(containerip string, externalPrefix []string, maps []*PortMapping) (preExec [][]string, err error)

Types

type PortMapping

type PortMapping struct {
	Protocol  string
	ToPorts   *PortRange
	FromPorts *PortRange
}

func NewPortMapping

func NewPortMapping(proto, from, to string) (*PortMapping, error)

NewPortMapping generate a PortMapping from three strings: proto (tcp or udp, default is tcp), and from/to port (single port or a range, see NewPortRange)

type PortRange

type PortRange struct {
	Begin int
	End   int
}

func NewPortRange

func NewPortRange(r string) (*PortRange, error)

NewPortRange generate a port range from string r. the r should be a decimal number or in format begin-end, where begin and end are both decimal number. And the port range should be 0-65535, i.e. 16-bit unsigned int It returns PortRange pointer for valid input, otherwise return error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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