network

package
Version: v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package network provides port allocation managers

Index

Constants

View Source
const (
	// Private denotes localhost
	Private = "127.0.0.1"

	// Public denotes 0.0.0.0
	Public = "0.0.0.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

Registry manages host network usage

func NewRegistry

func NewRegistry(logger *zap.SugaredLogger, host string, portRanges []string) *Registry

NewRegistry creates a new registry with given host address and available port ranges. Elements of portRanges can be "<PORT>" or "<LOWER>-<UPPER>"

func (*Registry) AssignPort

func (reg *Registry) AssignPort() (string, error)

AssignPort assigns an available port and returns it

func (*Registry) Close

func (reg *Registry) Close()

Close stops the registry cache cleanup

Jump to

Keyboard shortcuts

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