handler

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebugInfo

func DebugInfo(w http.ResponseWriter, req *http.Request)

DebugInfo responds the inner http server running information.

func DownloadByGetter

func DownloadByGetter(url string, header map[string][]string, name string) (string, error)

DownloadByGetter is to download file by DFGetter

func GetArgs

func GetArgs(w http.ResponseWriter, r *http.Request)

GetArgs returns all the arguments of command-line except the program name.

func GetEnv

func GetEnv(w http.ResponseWriter, r *http.Request)

GetEnv returns the environments of dfdaemon

func Process

func Process(w http.ResponseWriter, r *http.Request)

Process makes the dfdaemon as a reverse proxy to download image layers by dragonfly

Types

type DFGetter

type DFGetter struct {
	// contains filtered or unexported fields
}

DFGetter implements Downloader to download file by dragonfly

func (*DFGetter) Download

func (dfGetter *DFGetter) Download(url string, header map[string][]string, name string) (string, error)

Download is the method of DFGetter to download by dragonfly.

type DFRoundTripper

type DFRoundTripper struct {
	Round  *http.Transport
	Round2 http.RoundTripper
}

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 (*DFRoundTripper) RoundTrip

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

RoundTrip only process first redirect at present fix resource release

type Downloader

type Downloader interface {
	// Download download url file to file name
	// return dst path and download error
	Download(url string, header map[string][]string, name string) (string, error)
}

Downloader is an interface to download file

Jump to

Keyboard shortcuts

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