download

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package download provides buffalo handlers that implement vgo's Download Protocol. This is so that both Zeus and Olympus can share the same download protocol implementation.

Index

Constants

View Source
const PathLatest = "/{module:.+}/@latest"

PathLatest URL.

View Source
const PathList = "/{module:.+}/@v/list"

PathList URL.

View Source
const PathVersionInfo = "/{module:.+}/@v/{version}.info"

PathVersionInfo URL.

View Source
const PathVersionModule = "/{module:.+}/@v/{version}.mod"

PathVersionModule URL.

View Source
const PathVersionZip = "/{module:.+}/@v/{version}.zip"

PathVersionZip URL.

Variables

This section is empty.

Functions

func LatestHandler

func LatestHandler(dp Protocol, lggr *log.Logger, eng *render.Engine) func(c buffalo.Context) error

LatestHandler implements GET baseURL/module/@latest

func ListHandler

func ListHandler(dp Protocol, lggr *log.Logger, eng *render.Engine) func(c buffalo.Context) error

ListHandler implements GET baseURL/module/@v/list

func VersionInfoHandler

func VersionInfoHandler(dp Protocol, lggr *log.Logger, eng *render.Engine) buffalo.Handler

VersionInfoHandler implements GET baseURL/module/@v/version.info

func VersionModuleHandler

func VersionModuleHandler(dp Protocol, lggr *log.Logger, eng *render.Engine) buffalo.Handler

VersionModuleHandler implements GET baseURL/module/@v/version.mod

func VersionZipHandler

func VersionZipHandler(dp Protocol, lggr *log.Logger, eng *render.Engine) buffalo.Handler

VersionZipHandler implements GET baseURL/module/@v/version.zip

Types

type Protocol

type Protocol interface {
	// List implements GET /{module}/@v/list
	List(ctx context.Context, mod string) ([]string, error)

	// Info implements GET /{module}/@v/{version}.info
	Info(ctx context.Context, mod, ver string) ([]byte, error)

	// Latest implements GET /{module}/@latest
	Latest(ctx context.Context, mod string) (*storage.RevInfo, error)

	// GoMod implements GET /{module}/@v/{version}.mod
	GoMod(ctx context.Context, mod, ver string) ([]byte, error)

	// Zip implements GET /{module}/@v/{version}.zip
	Zip(ctx context.Context, mod, ver string) (io.ReadCloser, error)

	// Version is a helper method to get Info, GoMod, and Zip together.
	Version(ctx context.Context, mod, ver string) (*storage.Version, error)
}

Protocol is the download protocol which mirrors the http requests that cmd/go makes to the proxy.

func New

func New(dp Protocol, s storage.Backend) Protocol

New takes an upstream Protocol and storage it always prefers storage, otherwise it goes to upstream and fills the storage with the results.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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