gopp

package module
v0.0.0-...-c6b7210 Latest Latest
Warning

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

Go to latest
Published: May 20, 2019 License: MIT Imports: 12 Imported by: 0

README

gopp

gopp is the GOPROXY of GOPROXY

GoDoc CircleCI codecov Go Report Card

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrHandler

type ErrHandler func(w http.ResponseWriter, r *http.Request, err error)

ErrHandler represents handler for handling error

type Info

type Info struct {
	Version string    // version string
	Time    time.Time // commit time
}

Info defined for json response. see `go help goproxy`

type InfoProxyHandler

type InfoProxyHandler func(w http.ResponseWriter, r *http.Request, info *Info) error

InfoProxyHandler represents proxy handler for /@latest and /@v/v0.0.1.info info receieves information of the go release version.

type ListProxyHandler

type ListProxyHandler func(w http.ResponseWriter, r *http.Request, versionList []string) error

ListProxyHandler represents proxy handler for /@v/list versionList receieves list of the go release version which is following semantic versioning.

type ModProxyHandler

type ModProxyHandler func(w http.ResponseWriter, r *http.Request, body io.Reader) error

ModProxyHandler represents proxy handler for /@v/v0.0.1.mod body receieves mod file. body will close file descripter at outside of the handler.

type Proxy

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

Proxy proxies to GOPROXY of upstream. this struct is satisfied http.Handler.

func NewProxy

func NewProxy(c ProxyClient, upstreamGoProxyHost string) (*Proxy, error)

NewProxy makes proxy of the GOPROXY. returns Proxy struct which is satisfied http.Handler.

func (*Proxy) AddErrHandler

func (p *Proxy) AddErrHandler(h ErrHandler) error

AddErrHandler registers error handler

func (*Proxy) AddInfoProxyHandler

func (p *Proxy) AddInfoProxyHandler(h InfoProxyHandler) error

AddInfoProxyHandler registers proxy handler for /@latest and /@v/v0.0.1.info

func (*Proxy) AddListProxy

func (p *Proxy) AddListProxy(h ListProxyHandler) error

AddListProxy registers proxy handler for /@v/list

func (*Proxy) AddModProxyHandler

func (p *Proxy) AddModProxyHandler(h ModProxyHandler) error

AddModProxyHandler registers proxy handler for /@v/v0.0.1.mod

func (*Proxy) AddZipProxyHandler

func (p *Proxy) AddZipProxyHandler(h ZipProxyHandler) error

AddZipProxyHandler registers proxy handler for /@v/v0.0.1.zip

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ProxyClient

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

ProxyClient interface represents http client. http.Client is satisfied this interface.

type ZipProxyHandler

type ZipProxyHandler func(w http.ResponseWriter, r *http.Request, body io.Reader) error

ZipProxyHandler represents proxy handler for /@v/v0.0.1.zip body receieves zip file. body will close file descripter at outside of the handler.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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