client

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStrategyFallback = errors.New("fallback to next strategy")

Functions

func RetryPolicy added in v0.4.0

func RetryPolicy(ctx context.Context, resp *http.Response, err error) (bool, error)

RetryPolicy wraps retryablehttp.DefaultRetryPolicy and included additional logic: - checks for specific errors that indicate a fall-back to the next download strategy - checks for http.StatusBadGateway and http.StatusServiceUnavailable which also indicate a fall-back

Types

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

func NewHTTPClient added in v0.2.0

func NewHTTPClient(opts Options) HTTPClient

NewHTTPClient factory function returns a new http.Client with the appropriate settings and can limit number of clients per host if the OptMaxConnPerHost option is set.

type Options added in v0.2.0

type Options struct {
	MaxRetries    int
	Transport     http.RoundTripper
	TransportOpts TransportOptions
}

type PGetHTTPClient added in v0.8.2

type PGetHTTPClient struct {
	*http.Client
}

PGetHTTPClient is a wrapper around http.Client that allows for limiting the number of concurrent connections per host utilizing a client pool. If the OptMaxConnPerHost option is not set, the client pool will not be used.

func (*PGetHTTPClient) Do added in v0.8.2

func (c *PGetHTTPClient) Do(req *http.Request) (*http.Response, error)

type TransportOptions added in v0.7.1

type TransportOptions struct {
	ForceHTTP2       bool
	ResolveOverrides map[string]string
	MaxConnPerHost   int
	ConnectTimeout   time.Duration
}

Jump to

Keyboard shortcuts

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