plugins

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SymbolValidating = "ValidatingPlugin"
	SymbolMutating   = "MutatingPlugin"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Loader

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

Loader is used to load Cap10 plugins

func NewLoader

func NewLoader(ctx context.Context, paths string) *Loader

NewLoader creates a new instance of Loader

func (*Loader) LoadAll

func (l *Loader) LoadAll() error

func (*Loader) LookupM

func (l *Loader) LookupM() []MutatingPlugin

func (*Loader) LookupV

func (l *Loader) LookupV() []ValidatingPlugin

type MutatingPlugin

type MutatingPlugin interface {
	Mutate(r *http.Request) error
}

MutatingPlugin takes a request and makes arbitrary modifications before passing it to the reverse proxy.

Returning an error will cause a 500 Internal Server Error to be returned to the requester.

type ValidatingPlugin

type ValidatingPlugin interface {
	IsValid(r *http.Request) (bool, error)
}

ValidatingPlugin takes a request and determines whether the request should be allowed to continue.

ValidatingPlugin's will always be called AFTER the MutatingPlugin's

Returning false or an error will cause a 400 Bad Request to be returned to the requester.

Jump to

Keyboard shortcuts

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