filters

package
v2.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 4

Documentation

Overview

Package filters implements common functionality of filters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(k *Kind)

Register registers a filter kind.

func ResetRegistry

func ResetRegistry()

ResetRegistry reset the filter kind registry, mainly for testing purpose.

func Unregister

func Unregister(name string)

Unregister unregisters a filter kind, mainly for testing purpose.

func WalkKind

func WalkKind(fn func(k *Kind) bool)

WalkKind walks the registry, calling fn for each filter kind, and stops walking if fn returns false. fn should never modify its parameter.

Types

type BaseSpec

type BaseSpec struct {
	supervisor.MetaSpec `json:",inline"`
	// contains filtered or unexported fields
}

BaseSpec is the universal spec for all filters.

func (*BaseSpec) JSONConfig

func (s *BaseSpec) JSONConfig() string

JSONConfig returns the config in json format.

func (*BaseSpec) Kind

func (s *BaseSpec) Kind() string

Kind returns kind.

func (*BaseSpec) Name

func (s *BaseSpec) Name() string

Name returns name.

func (*BaseSpec) Pipeline

func (s *BaseSpec) Pipeline() string

Pipeline returns the name of the pipeline this filter belongs to.

func (*BaseSpec) Super

func (s *BaseSpec) Super() *supervisor.Supervisor

Super returns super.

type Filter

type Filter interface {
	// Name returns the name of the filter.
	Name() string

	// Kind returns the kind of the filter, caller should never modify the
	// return value.
	Kind() *Kind

	// Spec returns the Spec of the filter instance.
	Spec() Spec

	// Init initializes the Filter.
	Init()

	// Inherit also initializes the Filter, the difference from Init is it
	// inherit something from the previousGeneration, but Inherit does NOT
	// handle the lifecycle of previousGeneration.
	Inherit(previousGeneration Filter)

	// Handle handles one HTTP request, all possible results
	// need be registered in Results.
	Handle(*context.Context) (result string)

	// Status returns its runtime status.
	// It could return nil.
	Status() interface{}

	// Close closes itself.
	Close()
}

Filter is the interface of filters handling traffic of various protocols.

func Create

func Create(spec Spec) Filter

Create creates a filter instance of kind.

type Kind

type Kind struct {
	// Name is the name of the filter kind.
	Name string

	// Description is the description of the filter.
	Description string

	// Results list all possible results of the filter, except the normal
	// result (i.e. empty string).
	Results []string

	// CreateInstance creates a new filter instance of the kind.
	CreateInstance func(spec Spec) Filter

	// DefaultSpec returns a spec for the filter, with default values. The
	// function should always return a new spec copy, because the caller
	// may modify the returned spec.
	DefaultSpec func() Spec
}

Kind contains the meta data and functions of a filter kind.

func GetKind

func GetKind(name string) *Kind

GetKind gets the filter kind by name, the caller should never modify the return value.

type Resiliencer

type Resiliencer interface {
	InjectResiliencePolicy(policies map[string]resilience.Policy)
}

Resiliencer is the interface of objects that accept resilience policies.

type Spec

type Spec interface {
	// Super returns supervisor
	Super() *supervisor.Supervisor

	// Name returns name.
	Name() string

	// Kind returns kind.
	Kind() string

	// Pipeline returns the name of the pipeline this filter belongs to.
	Pipeline() string

	// JSONConfig returns the config in json format.
	JSONConfig() string
	// contains filtered or unexported methods
}

Spec is the common interface of filter specs

func NewSpec

func NewSpec(super *supervisor.Supervisor, pipeline string, rawSpec interface{}) (spec Spec, err error)

NewSpec creates a filter spec and validates it.

Directories

Path Synopsis
Package builder implements builder filters.
Package builder implements builder filters.
Package certextractor implements a filter to extract given field from TLS.
Package certextractor implements a filter to extract given field from TLS.
Package connectcontrol implements filter for controlling connections of MQTT clients
Package connectcontrol implements filter for controlling connections of MQTT clients
Package corsadaptor implements a filter that adapts CORS stuff.
Package corsadaptor implements a filter that adapts CORS stuff.
Package fallback implements the fallback filter.
Package fallback implements the fallback filter.
Package headerlookup implements a filter that enriches request headers per request, looking up values from etcd.
Package headerlookup implements a filter that enriches request headers per request, looking up values from etcd.
Package headertojson implements a filter to convert HTTP request header to json.
Package headertojson implements a filter to convert HTTP request header to json.
Package kafka implements a kafka proxy for MQTT requests.
Package kafka implements a kafka proxy for MQTT requests.
Package kafka implements a kafka proxy for HTTP requests.
Package kafka implements a kafka proxy for HTTP requests.
Package meshadaptor provides MeshAdaptor filter.
Package meshadaptor provides MeshAdaptor filter.
Package mock provides Mock filter.
Package mock provides Mock filter.
Package mqttclientauth implements authentication for MQTT clients.
Package mqttclientauth implements authentication for MQTT clients.
Package oidcadaptor implements OpenID Connect authorization.
Package oidcadaptor implements OpenID Connect authorization.
Package opafilter implements OpenPolicyAgent function.
Package opafilter implements OpenPolicyAgent function.
Package proxies provides the common interface and implementation of proxies.
Package proxies provides the common interface and implementation of proxies.
grpcproxy
Package grpcproxy provides the proxy filter of gRPC.
Package grpcproxy provides the proxy filter of gRPC.
httpproxy
Package httpproxy provides the Proxy of HTTP.
Package httpproxy provides the Proxy of HTTP.
Package ratelimiter implements a rate limiter.
Package ratelimiter implements a rate limiter.
Package redirector implements a filter to handle HTTP redirects.
Package redirector implements a filter to handle HTTP redirects.
Package redirector implements a filter to handle HTTP redirects.
Package redirector implements a filter to handle HTTP redirects.
Package remotefilter implements the RemoteFilter filter to invokes remote apis.
Package remotefilter implements the RemoteFilter filter to invokes remote apis.
Package topicmapper maps MQTT topic to Kafka topics and key-value headers
Package topicmapper maps MQTT topic to Kafka topics and key-value headers
Package validator provides Validator filter to validates HTTP requests.
Package validator provides Validator filter to validates HTTP requests.
Package wasmhost implements a host environment for WebAssembly.
Package wasmhost implements a host environment for WebAssembly.

Jump to

Keyboard shortcuts

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