portmapping

package
v0.0.0-...-7949e55 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MultiplexedPortMapping

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

MultiplexedPortMapping is a PortMapper that maps many service ports to a single target port.

func NewMultiplexedPortMapping

func NewMultiplexedPortMapping(minPort, maxPort int32) *MultiplexedPortMapping

NewMultiplexedPortMapping creates and returns a new MultiplexedPortMapping instance.

func (*MultiplexedPortMapping) Add

func (m *MultiplexedPortMapping) Add(namespace, name string, port int32) (int32, error)

Add adds a new mapping between the given service port and the first port available in the range defined within minPort and maxPort. If there's no port left, an error will be returned.

func (*MultiplexedPortMapping) Find

func (m *MultiplexedPortMapping) Find(namespace, name string, port int32) (int32, bool)

Find searches the port mapped to the given service port.

func (*MultiplexedPortMapping) Remove

func (m *MultiplexedPortMapping) Remove(namespace, name string, port int32) (int32, bool)

Remove removes the mapping associated with the given service port.

func (*MultiplexedPortMapping) Set

func (m *MultiplexedPortMapping) Set(namespace, name string, fromPort, toPort int32) error

Set sets the service port to the given target port. If given fromPort or toPort are already mapped, an error will be returned.

type PortMapping

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

PortMapping is a PortMapper that map one service port to one target port.

func NewPortMapping

func NewPortMapping(minPort, maxPort int32) *PortMapping

NewPortMapping creates and returns a new PortMapping instance.

func (*PortMapping) Add

func (p *PortMapping) Add(namespace, name string, port int32) (int32, error)

Add adds a new mapping between the given service port and the first port available in the range defined within minPort and maxPort. If there's no port left, an error will be returned.

func (*PortMapping) Find

func (p *PortMapping) Find(namespace, name string, port int32) (int32, bool)

Find searches the port mapped to the given service port.

func (*PortMapping) Remove

func (p *PortMapping) Remove(namespace, name string, port int32) (int32, bool)

Remove removes the mapping associated with the given service port.

func (*PortMapping) Set

func (p *PortMapping) Set(namespace, name string, fromPort, toPort int32) error

Set maps the service port to the given target port.

Jump to

Keyboard shortcuts

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