rrdialer

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 15 Imported by: 10

Documentation

Overview

Package rrdialer implements a dialer which provides improved behaviour for hostnames with multiple IP addresses (aka. round-robin DNS).

Unlike the default net.Dialer which divides the timeout between the multiple endpoints (IP addresses), the round-robin dialer tracks the historic performance of each endpoint to dial the fastest endpoint first and will concurrently dial other endpoints if unusually long connection times are observed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialer

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

func New

func New(dialer *net.Dialer, cacheDir string,
	logger log.DebugLogger) (*Dialer, error)

New creates a new Dialer. The underlying raw dialer used to dial each endpoint is given by dialer. The directory in which endpoint statitics are written is given by cacheDir. If this is the empty string then the ".cache" subdirectory of the home directory is used. Log messages are written to logger. If the debug level is 3 or greater then all endpoints are dialed.

func (*Dialer) Dial

func (d *Dialer) Dial(network, address string) (net.Conn, error)

Dial connects to the address on the named network.

func (*Dialer) DialContext

func (d *Dialer) DialContext(ctx context.Context, network,
	address string) (net.Conn, error)

DialContext connects to the address on the named network using the provided context.

func (*Dialer) WaitForBackgroundResults

func (d *Dialer) WaitForBackgroundResults(timeout time.Duration)

WaitForBackgroundResults will wait up to timeout for other endpoint connection attempts to complete, so that their performance statistics can be saved. It is recommended to call this just before the main function returns.

Jump to

Keyboard shortcuts

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