filter

package
v2.1.0-RC.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2018 License: Apache-2.0 Imports: 4 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseFilter

type BaseFilter struct{}

BaseFilter base filter support default implemention

func (BaseFilter) Init

func (f BaseFilter) Init(cfg string) error

Init init filter

func (BaseFilter) Post

func (f BaseFilter) Post(c Context) (statusCode int, err error)

Post execute after proxy

func (BaseFilter) PostErr

func (f BaseFilter) PostErr(c Context)

PostErr execute proxy has errors

func (BaseFilter) Pre

func (f BaseFilter) Pre(c Context) (statusCode int, err error)

Pre execute before proxy

type Context

type Context interface {
	StartAt() time.Time
	EndAt() time.Time

	OriginRequest() *fasthttp.RequestCtx
	ForwardRequest() *fasthttp.Request
	Response() *fasthttp.Response

	API() *metapb.API
	DispatchNode() *metapb.DispatchNode
	Server() *metapb.Server
	Analysis() *util.Analysis

	SetAttr(key string, value interface{})
	GetAttr(key string) interface{}
}

Context filter context

type Filter

type Filter interface {
	Name() string
	Init(cfg string) error

	Pre(c Context) (statusCode int, err error)
	Post(c Context) (statusCode int, err error)
	PostErr(c Context)
}

Filter filter interface

Jump to

Keyboard shortcuts

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