dial

package
v0.0.0-...-998cc21 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSlowOrMaintained = fmt.Errorf("Slow or maintained endpoint")

ErrSlowOrMaintained is returned if LimitDialer exceeds connection limit

Functions

This section is empty.

Types

type LimitDialer

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

LimitDialer limits open connections by read and dial timeout. Also provides hard limit on number of open connections

func NewLimitDialer

func NewLimitDialer(limit int64, readTimeout, dialTimeout time.Duration) *LimitDialer

NewLimitDialer returns new `LimitDialer`.

func (*LimitDialer) Dial

func (d *LimitDialer) Dial(network, addr string) (c net.Conn, err error)

Dial connects to endpoint as net.Dial does, but also keeps track on number of connections

func (*LimitDialer) DropEndpoint

func (d *LimitDialer) DropEndpoint(endpoint string)

DropEndpoint marks backend as dropped i.e. maintenance x

Jump to

Keyboard shortcuts

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