proxy

package
v0.0.0-...-514a694 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	VersionRegex = regexp.MustCompile(`^/v\d\.\d+\b`)

	ErrForbidden = errors.New("error: access to resource denied")
)

Functions

func ErrorHandler

func ErrorHandler(msg string, code int) http.Handler

func JsonHandler

func JsonHandler(data interface{}) http.Handler

func Match

func Match(req *http.Request, method string, pattern string) bool

func WriteError

func WriteError(w http.ResponseWriter, msg string, code int)

Types

type Interceptor

type Interceptor interface {
	Intercept(l Logger, req *http.Request, upstream http.Handler) http.Handler
}

Interceptor returns an http.Handler that either passes through to an upstream handler or imposes some logic of it's own on the request.

type InterceptorFunc

type InterceptorFunc func(l Logger, req *http.Request, upstream http.Handler) http.Handler

func (InterceptorFunc) Direct

func (i InterceptorFunc) Direct(l Logger, req *http.Request, upstream http.Handler) http.Handler

type Logger

type Logger interface {
	Printf(format string, v ...interface{})
}

Logger is a subset of log.Logger used in a Proxy request

type Proxy

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

Proxy ...

func NewProxy

func NewProxy(dockerURL string, tlsconfig *tls.Config, interceptor Interceptor) (*Proxy, error)

NewProxy ...

func (*Proxy) ServeHTTP

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

Handler ...

Jump to

Keyboard shortcuts

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