network

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package network currently provides sane defaults http and ssh transport config to be used across all network operations.

Index

Constants

This section is empty.

Variables

View Source
var (

	// RetryStatusCodes contains HTTP status codes that indicate retryable errors.
	// Derived from retryReasons. Can be passed to libraries like go-containerregistry
	// via remote.WithRetryStatusCodes().
	RetryStatusCodes []int
)

defaultTransport holds the configured transport before any wrapping. This allows NewTransport to clone from it.

Functions

func SetDefaults

func SetDefaults()

SetDefaults configures http.DefaultTransport with our TLS and connection settings, and wraps it with logging. Must be called once at startup before any HTTP requests.

Types

type ClientConfig added in v0.4.0

type ClientConfig struct {
	ssh.ClientConfig

	KeepAliveTimeout time.Duration

	IdentityFiles []string
}

ClientConfig extends ssh.ClientConfig with keepalive and identity file settings.

func GetClientConfig added in v0.4.0

func GetClientConfig() *ClientConfig

GetClientConfig returns a new SSH client configuration with hardened defaults.

type RoundTripper

type RoundTripper struct {
	*http.Transport

	TokenValue string
	TokenType  string
}

RoundTripper wraps *http.Transport with auth header injection and logging for retryable responses. Callers can modify TLSClientConfig directly via the embedded transport (e.g., custom CAs, client certs).

func NewTransport

func NewTransport() *RoundTripper

NewTransport returns a new RoundTripper cloned from the default configuration. The returned RoundTripper can be modified (e.g., adding client certificates) without affecting http.DefaultTransport. Panics if SetDefaults has not been called.

func (*RoundTripper) RoundTrip

func (rt *RoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper.

Directories

Path Synopsis
Package transporter provides a retry-backoff transport client.
Package transporter provides a retry-backoff transport client.

Jump to

Keyboard shortcuts

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