Documentation ¶
Overview ¶
Package reghttp is used for HTTP requests to a registry
Index ¶
- Constants
- func HTTPError(statusCode int) error
- type Client
- type Opts
- func WithCertDirs(dirs []string) Opts
- func WithCertFiles(files []string) Opts
- func WithCerts(certs [][]byte) Opts
- func WithConfigHost(gch func(string) *config.Host) Opts
- func WithDelay(delayInit time.Duration, delayMax time.Duration) Opts
- func WithHTTPClient(hc *http.Client) Opts
- func WithLog(log *logrus.Logger) Opts
- func WithRetryLimit(rl int) Opts
- func WithTransport(t *http.Transport) Opts
- func WithUserAgent(ua string) Opts
- type Req
- type ReqAPI
- type Resp
Constants ¶
const (
DefaultRetryLimit = 3
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an HTTP client wrapper It handles features like authentication, retries, backoff delays, TLS settings
type Opts ¶
type Opts func(*Client)
Opts is used to configure client options
func WithCertDirs ¶
WithCertDirs adds directories to check for host specific certs
func WithCertFiles ¶
WithCertFiles adds certificates by filename
func WithConfigHost ¶ added in v0.5.0
WithConfigHost adds the callback to request a config.Host struct
func WithDelay ¶
WithDelay initial time to wait between retries (increased with exponential backoff)
func WithHTTPClient ¶
WithHTTPClient uses a specific http client with retryable requests
func WithRetryLimit ¶
WithRetryLimit restricts the number of retries (defaults to 5)
func WithTransport ¶
WithTransport uses a specific http transport with retryable requests
type Req ¶
type Req struct { Host string NoMirrors bool APIs map[string]ReqAPI // allow different types of registries (registry/2.0, OCI, default to empty string) }
Req is a request to send to a registry
type ReqAPI ¶
type ReqAPI struct { Method string DirectURL *url.URL NoPrefix bool Repository string Path string Query url.Values BodyLen int64 BodyBytes []byte BodyFunc func() (io.ReadCloser, error) Headers http.Header Digest digest.Digest IgnoreErr bool }
ReqAPI handles API specific settings in a request