plugin

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingName                 = errors.New("missing name")
	ErrMissingParseConfMethod      = errors.New("missing ParseConf method")
	ErrMissingRequestFilterMethod  = errors.New("missing RequestFilter method")
	ErrMissingResponseFilterMethod = errors.New("missing ResponseFilter method")

	RequestPhase  = requestPhase{}
	ResponsePhase = responsePhase{}
)

Functions

func HTTPReqCall

func HTTPReqCall(buf []byte, conn net.Conn) (*flatbuffers.Builder, error)

func HTTPRespCall added in v0.4.0

func HTTPRespCall(buf []byte, conn net.Conn) (*flatbuffers.Builder, error)

func InitConfCache

func InitConfCache(ttl time.Duration)

func PrepareConf

func PrepareConf(buf []byte) (*flatbuffers.Builder, error)

func RegisterPlugin

func RegisterPlugin(name string, pc ParseConfFunc, sv RequestFilterFunc, rsv ResponseFilterFunc) error

func SetRuleConfInTest added in v0.2.0

func SetRuleConfInTest(token uint32, conf RuleConf) error

Types

type ConfCache added in v0.2.0

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

func (*ConfCache) Get added in v0.2.0

func (cc *ConfCache) Get(token uint32) (RuleConf, error)

func (*ConfCache) Set added in v0.2.0

func (cc *ConfCache) Set(req *pc.Req) (uint32, error)

func (*ConfCache) SetInTest added in v0.2.0

func (cc *ConfCache) SetInTest(token uint32, entries RuleConf) error

type ConfEntry

type ConfEntry struct {
	Name  string
	Value interface{}
}

type ErrPluginRegistered

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

func (ErrPluginRegistered) Error

func (err ErrPluginRegistered) Error() string

type ParseConfFunc

type ParseConfFunc func(in []byte) (conf interface{}, err error)

type RequestFilterFunc added in v0.4.0

type RequestFilterFunc func(conf interface{}, w http.ResponseWriter, r pkgHTTP.Request)

type ResponseFilterFunc added in v0.4.0

type ResponseFilterFunc func(conf interface{}, w pkgHTTP.Response)

type RuleConf

type RuleConf []ConfEntry

func GetRuleConf

func GetRuleConf(token uint32) (RuleConf, error)

Jump to

Keyboard shortcuts

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