netx

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package netx contains experimental helpers related to network.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadCACert added in v1.4.0

func LoadCACert(path string) (*x509.CertPool, error)

LoadCACert returns a new CertPool with certificates loaded from given path.

func UnusedTCPPort

func UnusedTCPPort(host string) (port int)

UnusedTCPPort returns random unique unused TCP port at host.

func WaitTCPPort

func WaitTCPPort(ctx context.Context, addr fmt.Stringer) error

WaitTCPPort tries to connect to addr until success or ctx.Done.

Types

type Addr

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

Addr provides different ways to get host and port.

func NewAddr

func NewAddr(host string, port int) Addr

NewAddr creates new Addr.

func (Addr) Host

func (a Addr) Host() string

Host returns host.

func (Addr) Port

func (a Addr) Port() int

Port returns port.

func (Addr) String

func (a Addr) String() string

String returns host:port.

Jump to

Keyboard shortcuts

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