matcher

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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustRegister

func MustRegister(matches TransCoderMatchesFunc)

func RegisterMatcherFatcory

func RegisterMatcherFatcory(typ string, factory MatcherFactory)

Types

type MatcherConfig

type MatcherConfig struct {
	MatcherType string      `json:"matcher_type,omitempty"`
	Config      interface{} `json:"config,omitempty"`
}

type MatcherFactory

type MatcherFactory func(config interface{}) RuleMatcher

type RuleInfo

type RuleInfo struct {
	Type             string                 `json:"-"`
	UpstreamProtocol string                 `json:"upstream_protocol,omitempty"`
	Description      string                 `json:"description,omitempty"`
	Config           map[string]interface{} `json:"config,omitempty"`
}

func DefaultMatches

func DefaultMatches(ctx context.Context, header api.HeaderMap, rules []*TransferRule) (*RuleInfo, bool)

func (*RuleInfo) GetType

func (ri *RuleInfo) GetType(srcPro api.ProtocolName) string

type RuleMatcher

type RuleMatcher interface {
	Matches(ctx context.Context, headers api.HeaderMap) bool
}

func NewMatcher

func NewMatcher(cfg *MatcherConfig) RuleMatcher

type TransCoderMatchesFunc

type TransCoderMatchesFunc func(ctx context.Context, header api.HeaderMap, rules []*TransferRule) (*RuleInfo, bool)
var TransCoderMatches TransCoderMatchesFunc

type TransferRule

type TransferRule struct {
	Matcher  RuleMatcher
	RuleInfo *RuleInfo
}

type TransferRuleConfig

type TransferRuleConfig struct {
	MatcherConfig *MatcherConfig `json:"matcher_config,omitempty"`
	RuleInfo      *RuleInfo      `json:"rule_info,omitempty"`
}

Jump to

Keyboard shortcuts

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