Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface { List(ctx *Context) Info(ctx *Context) Latest(ctx *Context) Mod(ctx *Context) Zip(ctx *Context) }
Backend implements all the standard interfaces of GOPROXY, which is the upstream of request processing
type Config ¶
type Config struct { UpstreamAddr string `valid:"url"` ListenAddr string `valid:"url"` GoBinaryPath string }
Config contains configuration information for the entire proxy project
type Engine ¶
type Engine struct { Config // contains filtered or unexported fields }
Engine controls the operation of the entire Proxy
func (*Engine) GetBackend ¶
GetBackend is used to get the current Backend
func (*Engine) GetHandler ¶
GetHandler chooses which processor to use based on the requested path
func (*Engine) Interceptor ¶
func (engine *Engine) Interceptor() gin.HandlerFunc
Interceptor intercepts all requests to process the GOPROXY part
func (*Engine) SetBackend ¶
SetBackend is used to switch backend used by proxy
type Fetcher ¶
type Fetcher interface { List(*module.Module) (io.ReadCloser, error) Info(*module.Module) (io.ReadCloser, error) Latest(*module.Module) (io.ReadCloser, error) Mod(*module.Module) (io.ReadCloser, error) Zip(*module.Module) (io.ReadCloser, error) }
Fetcher defined the interface of GORPOXY api
type StreamDestType ¶
type StreamDestType uint8
StreamDestType defines the destination to process the request
const ( StreamDestTypeUnknown StreamDestType = iota StreamDestTypeLocal StreamDestTypeUpstream )
Define a set of common stream dest type
type StreamSplitter ¶
type StreamSplitter interface {
Split(c *Context) StreamDestType
}
StreamSplitter is used to separate requests, it determines whether a goproxy request should use upstream or local