Documentation
¶
Overview ¶
Package retry provides shared retry logic with exponential backoff for network operations across Katzenpost components.
Index ¶
- Constants
- func Delay(baseDelay, maxDelay time.Duration, jitter float64, attempt int) time.Duration
- func DetectAddressCapabilities(addresses []string) (hasIPv4, hasIPv6 bool)
- func FilterUsableAddresses(addresses []string, hasIPv4, hasIPv6, disableIPv4, disableIPv6 bool) []string
- func IsTransientError(err error) bool
Constants ¶
const ( // DefaultMaxAttempts is the default maximum number of retry attempts DefaultMaxAttempts = 10 // DefaultBaseDelay is the default base delay between retries DefaultBaseDelay = 500 * time.Millisecond // DefaultMaxDelay is the default maximum delay between retries DefaultMaxDelay = 10 * 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 ¶
Delay calculates the delay for a given retry attempt using exponential backoff with jitter.
func DetectAddressCapabilities ¶
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 ¶
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.