netsetup

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 9 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 netsetup defines network preparation deadlines and recoverable DNS retries.

Index

Constants

View Source
const (
	// ResolveTimeout allows the system resolver to try alternate nameservers before a lookup is abandoned.
	ResolveTimeout = 30 * time.Second
	// DialTimeout bounds DNS resolution and TCP connection establishment, independently of protocol handshakes.
	DialTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

func RetryDNS

func RetryDNS(ctx context.Context, logger *slog.Logger, operation func() error) error

RetryDNS retries DNS failures, including missing records, with full jitter from a 1-second to a 5-second ceiling. Each operation must impose its own lookup deadline without shortening the lifetime of a successful resource.

Types

type RetryNotice

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

RetryNotice reports prolonged failed attempts without logging every retry. It is owned by one recovery loop.

func NewRetryNotice

func NewRetryNotice(logger *slog.Logger, operation string) *RetryNotice

NewRetryNotice starts a quiet 30-second preparation window before failed attempts can produce warnings.

func (*RetryNotice) Failed

func (n *RetryNotice) Failed(attributes ...any)

Failed emits at most one warning per minute after the initial quiet window.

func (*RetryNotice) Recovered

func (n *RetryNotice) Recovered()

Recovered reports recovery only after a warning and resets the quiet window for the next outage.

Jump to

Keyboard shortcuts

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