retry

package
v0.0.69 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2025 License: AGPL-3.0, AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package retry provides shared retry logic with exponential backoff for network operations across Katzenpost components.

Index

Constants

View Source
const (
	// DefaultMaxAttempts is the default maximum number of retry attempts
	DefaultMaxAttempts = 20

	// DefaultBaseDelay is the default base delay between retries
	DefaultBaseDelay = 10 * time.Millisecond

	// DefaultMaxDelay is the default maximum delay between retries
	DefaultMaxDelay = 3 * time.Second

	// DefaultJitter is the default jitter factor (0.0 to 1.0)
	DefaultJitter = 0.2
)

Default retry configuration constants

Variables

This section is empty.

Functions

func Delay

func Delay(baseDelay, maxDelay time.Duration, jitter float64, attempt int) time.Duration

Delay calculates the delay for a given retry attempt using exponential backoff with jitter.

func DetectAddressCapabilities

func DetectAddressCapabilities(addresses []string) (hasIPv4, hasIPv6 bool)

DetectAddressCapabilities analyzes a list of addresses (which may be URLs) to determine if IPv4 and/or IPv6 addresses are present.

func FilterUsableAddresses

func FilterUsableAddresses(addresses []string, hasIPv4, hasIPv6, disableIPv4, disableIPv6 bool) []string

FilterUsableAddresses filters addresses based on detected capabilities and config flags. It returns only addresses that match the available address families and are not disabled.

func IsTransientError

func IsTransientError(err error) bool

IsTransientError returns true if the error is likely transient and worth retrying. This includes network timeouts, connection refused, connection reset, etc.

Types

This section is empty.

Jump to

Keyboard shortcuts

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