plugin

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 16 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")
	ErrMissingFilterMethod    = errors.New("missing Filter method")
)

Functions

func HTTPReqCall

func HTTPReqCall(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 FilterFunc) 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 FilterFunc

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

type ParseConfFunc

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

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