headertometadata

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

View Source
const (
	HeaderToMetadata = "header_to_metadata"
)

Stream Filter's Name

Variables

View Source
var (
	ErrEmptyHeader           = errors.New("header must not be empty")
	ErrBothPresentAndMissing = errors.New("cannot specify both on_header_present and on_header_missing")
	ErrNeedPresentOrMissing  = errors.New("one of on_header_present or on_header_missing needs to be specified")
)

Functions

func CreateFilterFactory

func CreateFilterFactory(conf map[string]interface{}) (api.StreamFilterChainFactory, error)

CreateFilterFactory for create HeaderToMetadata filter factory

Types

type Filter

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

func NewFilter

func NewFilter(factory *FilterFactory) *Filter

func (*Filter) OnDestroy

func (f *Filter) OnDestroy()

func (*Filter) OnReceive

func (f *Filter) OnReceive(ctx context.Context, headers api.HeaderMap, buf api.IoBuffer, trailers api.HeaderMap) api.StreamFilterStatus

func (*Filter) SetReceiveFilterHandler

func (f *Filter) SetReceiveFilterHandler(handler api.StreamReceiverFilterHandler)

type FilterFactory

type FilterFactory struct {
	Rules []Rule `json:"request_rules"`
}

func (*FilterFactory) CreateFilterChain

func (f *FilterFactory) CreateFilterChain(context context.Context, callbacks api.StreamFilterChainFactoryCallbacks)

CreateFilterChain for create HeaderToMetadata filter

type KVPair

type KVPair struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Rule

type Rule struct {
	Header    string  `json:"header"`
	OnPresent *KVPair `json:"on_header_present"`
	OnMissing *KVPair `json:"on_header_missing"`
	Remove    bool    `json:"remove"`
}

Jump to

Keyboard shortcuts

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