netutil

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrListenerStopped indicates that the server has been stopped.
	ErrListenerStopped = errors.New("server stopped")
)

Functions

func GetClientTLSConfig

func GetClientTLSConfig(hostname string,
	caFile string, certFile string, keyFile string) (*tls.Config, error)

GetClientTLSConfig returns client TLS config.

func GetHost

func GetHost(addr string) (string, error)

GetHost return sthe host component from the specified address.

func GetServerTLSConfig

func GetServerTLSConfig(caFile string, certFile string,
	keyFile string) (*tls.Config, error)

GetServerTLSConfig returns the server TLS config.

func NewBreaker

func NewBreaker() *circuit.Breaker

NewBreaker returns a new breaker.

Types

type StoppableListener

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

StoppableListener is a type of TCP listener that can be stopped by signalling the associated stopc channel. It binds to all IPs resolved from the specified address.

func NewStoppableListener

func NewStoppableListener(addr string, tlsConfig *tls.Config,
	stopc <-chan struct{}) (*StoppableListener, error)

NewStoppableListener returns a listener that can be stopped.

func (*StoppableListener) Accept

func (ln *StoppableListener) Accept() (net.Conn, error)

Accept starts to accept incoming connections.

func (*StoppableListener) Addr

func (ln *StoppableListener) Addr() net.Addr

Addr returns the net.Addr of the listener.

func (*StoppableListener) Close

func (ln *StoppableListener) Close() error

Close closes the listener.

Directories

Path Synopsis
cenk
backoff
Package backoff implements backoff algorithms for retrying operations.
Package backoff implements backoff algorithms for retrying operations.
facebookgo
rubyist
circuitbreaker
Package circuit implements the Circuit Breaker pattern.
Package circuit implements the Circuit Breaker pattern.

Jump to

Keyboard shortcuts

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