networkutils

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPortValid added in v0.7.0

func IsPortValid(port string) bool

func ValidateIP added in v0.8.0

func ValidateIP(ip string) error

Types

type DefaultNetClient

type DefaultNetClient struct{}

func (*DefaultNetClient) DialTimeout

func (n *DefaultNetClient) DialTimeout(network, address string, timeout time.Duration) (net.Conn, error)

type IPGenerator

type IPGenerator interface {
	GenerateUniqueIP(cidrBlock string) (string, error)
	IsIPUnique(ip string) bool
}

func NewIPGenerator

func NewIPGenerator(netClient NetClient) IPGenerator

type IPPool added in v0.7.1

type IPPool []string

func NewIPPool added in v0.7.1

func NewIPPool() IPPool

func NewIPPoolFromEnv added in v0.7.1

func NewIPPoolFromEnv(ipPoolEnvVar string) (IPPool, error)

func NewIPPoolFromString added in v0.7.1

func NewIPPoolFromString(fromString string) IPPool

func (*IPPool) AddIP added in v0.7.1

func (ipPool *IPPool) AddIP(ip string)

func (*IPPool) IsEmpty added in v0.7.1

func (ipPool *IPPool) IsEmpty() bool

func (*IPPool) PopIP added in v0.7.1

func (ipPool *IPPool) PopIP() (string, error)

func (*IPPool) ToEnvVar added in v0.7.1

func (ipPool *IPPool) ToEnvVar(envVarName string) error

func (*IPPool) ToString added in v0.7.1

func (ipPool *IPPool) ToString() string

type NetClient

type NetClient interface {
	DialTimeout(network, address string, timeout time.Duration) (net.Conn, error)
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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