proxy

package
v0.0.0-...-c804474 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultHostAcceptRE is the default value for which hosts to accept.
	DefaultHostAcceptRE = "^localhost$,^127\\.0\\.0\\.1$,^\\[::1\\]$"
	// DefaultPathAcceptRE is the default path to accept.
	DefaultPathAcceptRE = "^.*"
	// DefaultPathRejectRE is the default set of paths to reject.
	DefaultPathRejectRE = "^$"
	// DefaultMethodRejectRE is the set of HTTP methods to reject by default.
	DefaultMethodRejectRE = "^$"
)
View Source
const AutoSkipCacheREList = "^/api/.*/pods/.*/exec,^/api/.*/pods/.*/attach"

Variables

View Source
var (
	// ReverseProxyFlushInterval is the frequency to flush the reverse proxy.
	// Only matters for long poll connections like the one used to watch. With an
	// interval of 0 the reverse proxy will buffer content sent on any connection
	// with transfer-encoding=chunked.
	// TODO: Flush after each chunk so the client doesn't suffer a 100ms latency per
	// watch event.
	ReverseProxyFlushInterval = 100 * time.Millisecond
)

Functions

func MakeRegexpArray

func MakeRegexpArray(str string) ([]*regexp.Regexp, error)

MakeRegexpArray splits a comma separated list of regexps into an array of Regexp objects.

func MakeRegexpArrayOrDie

func MakeRegexpArrayOrDie(str string) []*regexp.Regexp

MakeRegexpArrayOrDie creates an array of regular expression objects from a string or exits.

func RequestLogHandler

func RequestLogHandler(h http.Handler) http.Handler

RequestLogHandler - log the requests that come through the proxy.

func Run

func Run(done chan error, o Options) error

Run will start a proxy server in a go routine that returns on the error channel if something is not correct on startup. Run will not return until the network socket is listening.

Types

type FilterServer

type FilterServer struct {
	// Only paths that match this regexp will be accepted
	AcceptPaths []*regexp.Regexp
	// Paths that match this regexp will be rejected, even if they match the above
	RejectPaths []*regexp.Regexp
	// Hosts are required to match this list of regexp
	AcceptHosts []*regexp.Regexp
	// Methods that match this regexp are rejected
	RejectMethods []*regexp.Regexp
	// contains filtered or unexported fields
}

FilterServer rejects requests which don't match one of the specified regular expressions

func (*FilterServer) HandlerFor

func (f *FilterServer) HandlerFor(delegate http.Handler) *FilterServer

HandlerFor makes a shallow copy of f which passes its requests along to the new delegate.

func (*FilterServer) ServeHTTP

func (f *FilterServer) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type HandlerChain

type HandlerChain func(http.Handler) http.Handler

HandlerChain will be used for users to pass defined handlers to the proxy. The hander chain will be run after InjectingOwnerReference if it is added and before the proxy handler.

type Options

type Options struct {
	Address           string
	Port              int
	Handler           HandlerChain
	KubeConfig        *rest.Config
	Cache             cache.Cache
	RESTMapper        meta.RESTMapper
	ControllerMap     *controllermap.ControllerMap
	WatchedNamespaces []string
	DisableCache      bool
	OwnerInjection    bool
	LogRequests       bool
}

Options will be used by the user to specify the desired details for the proxy.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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