transport

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DFRoundTripper

type DFRoundTripper struct {
	Round          *http.Transport
	Round2         http.RoundTripper
	ShouldUseDfget func(req *http.Request) bool
	Downloader     downloader.Interface
}

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 return 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 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