filter

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegistryFilter

func RegistryFilter(filter Filter)

RegistryFilter register filter

Types

type Chain

type Chain struct {
	Filters  []Filter
	Index    int
	Exchange *Exchange
	Route    config.Route
}

Chain struct

func NewChain

func NewChain(resp http.ResponseWriter, req *http.Request, route config.Route) *Chain

NewChain new chain

func (*Chain) DoFilter

func (c *Chain) DoFilter()

DoFilter run filter

type Exchange

type Exchange struct {
	Resp http.ResponseWriter
	Req  *http.Request
	Ctx  context.Context
	Attr map[string]interface{}

	Written sync.Once
	// contains filtered or unexported fields
}

Exchange struct

func (*Exchange) Completed

func (e *Exchange) Completed()

type Filter

type Filter interface {
	Init(mux *RouteMux)
	Name() string
	Filter(exchange *Exchange, c interface{}) error
}

Filter interface

type ProxyConfig

type ProxyConfig struct {
	URI string `asn1:"url"`
}

ProxyConfig struct

type ResourceConfig

type ResourceConfig struct {
	Root string
}

ResourceConfig struct

type RespErr added in v0.2.2

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

func NewRespErr added in v0.2.2

func NewRespErr(code int, msg string) *RespErr

func (*RespErr) Error added in v0.2.2

func (r *RespErr) Error() string

func (*RespErr) Html added in v0.2.2

func (r *RespErr) Html(resp http.ResponseWriter)

type RewriteConfig

type RewriteConfig struct {
	Regex       string
	Replacement string
}

RewriteConfig struct

type RouteMux added in v0.2.0

type RouteMux struct {
	Routes []config.Route
}

RouteMux struct

func NewRouteMux added in v0.2.0

func NewRouteMux(c *config.Config) *RouteMux

NewRouteMux new route mux

func (*RouteMux) ServeHTTP added in v0.2.0

func (r *RouteMux) ServeHTTP(resp http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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