Documentation
¶
Overview ¶
Package networkhttp keeps HTTP connection pools aligned with system routing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultClient = &http.Client{Transport: NewDefaultTransport()}
var ErrRouteChanged = errors.New("system network route changed")
ErrRouteChanged tells the owning retry loop to restart on the current route.
Functions ¶
func NewDefaultTransport ¶
func NewDefaultTransport() http.RoundTripper
NewDefaultTransport follows the standard client's current default transport, including custom RoundTrippers used by integrations and offline test fixtures.
Types ¶
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport replaces its connection pool when the system's routes change. New preserves active responses; NewRetrying interrupts them so the owning retry loop can restart. This transport never replays requests itself.
func NewForTest ¶
NewForTest supplies a deterministic routing snapshot for offline tests.
func NewRetrying ¶
NewRetrying also interrupts active requests on route changes. Use only when the caller owns a retry loop and permits replaying the request.
func (*Transport) CloseIdleConnections ¶
func (t *Transport) CloseIdleConnections()
func (*Transport) PrepareRetry ¶
func (t *Transport) PrepareRetry()
PrepareRetry discards the pool used by the failed attempt, even when a transient network change left the route tables unchanged. The next request opens a connection using the OS's current routing decision.