transport

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2020 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NeedUseGetter added in v1.0.0

func NeedUseGetter(req *http.Request) bool

needUseGetter is the default value for ShouldUseDfget, which downloads all images layers with dfget.

Types

type DFRoundTripper

type DFRoundTripper struct {
	Round            *http.Transport
	Round2           http.RoundTripper
	ShouldUseDfget   func(req *http.Request) bool
	Downloader       downloader.Interface
	StreamDownloader downloader.Stream
	// contains filtered or unexported fields
}

DFRoundTripper implements RoundTripper for dfget. It uses http.fileTransport to serve requests that need to use dfget, and uses http.Transport to serve the other requests.

func New

func New(opts ...Option) (*DFRoundTripper, error)

New returns the default DFRoundTripper.

func (*DFRoundTripper) RoundTrip

func (roundTripper *DFRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip only process first redirect at present fix resource release

type Option added in v0.4.0

type Option func(rt *DFRoundTripper) error

Option is functional config for DFRoundTripper.

func WithCondition added in v0.4.0

func WithCondition(c func(r *http.Request) bool) Option

WithCondition configures how to decide whether to use dfget or not.

func WithDownloader added in v0.4.0

func WithDownloader(d downloader.Interface) Option

WithDownloader sets the downloader for the roundTripper.

func WithStreamDownloader added in v1.0.1

func WithStreamDownloader(d downloader.Stream) Option

func WithStreamMode added in v1.0.1

func WithStreamMode(streamMode bool) Option

func WithTLS added in v0.4.0

func WithTLS(cfg *tls.Config) Option

WithTLS configures TLS config used for http transport.

Jump to

Keyboard shortcuts

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