stagger

package
v3.0.0-rc67 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package stagger connects to the first of several addresses to accept the connection, without the one that does not answer holding the others: the connect to an address starts when the one to the previous address failed, or ran a delay, as a dual-stack client falls back from an address of a family the node can not reach.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(ctx context.Context, delay time.Duration, attempts []Attempt) (net.Conn, error)

Dial runs the attempts in order, each one starting when the previous one failed or ran delay, and returns the first connection established. The attempts still running are abandoned then: their context ends, and a connection they establish meanwhile is closed. It returns the error of the first attempt when none connects.

Types

type Attempt

type Attempt func(ctx context.Context) (net.Conn, error)

Attempt connects to one address.

Jump to

Keyboard shortcuts

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