match

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CutUnit = 16

Functions

func CutToChunks

func CutToChunks(key []byte, unit int) [][]byte

func CutToChunksByProtocol

func CutToChunksByProtocol(key []byte, chunks [][]byte) ([]byte, [][]byte)

CutToChunksByProtocol 根据协议切分

func CutToChunksPostHandle

func CutToChunksPostHandle(key []byte, unit int, chunks [][]byte) [][]byte

CutToChunksPostHandle

func CutToChunksPreHandle

func CutToChunksPreHandle(key []byte, unit int) ([]byte, int)

CutToChunksPreHandle 预处理

func SortRequestParams

func SortRequestParams(key []byte) []byte

sortRequestParams 对HTTP参数排序,解决因两次请求参数顺序不一致而导致匹配失败的情况

Types

type Matcher

type Matcher struct {
	sync.Mutex

	EnableCursor    bool         // 是否开启 MaxMatchedIndex 游标
	MaxMatchedIndex int          // 游标,用于标记最大当前已匹配下标,在颠倒相同请求顺序时有效
	Visited         map[int]bool // 标记已匹配 Action
}

func New

func New() *Matcher

func (*Matcher) DoMatchOutboundTalk

func (m *Matcher) DoMatchOutboundTalk(
	ctx context.Context, session *replaying.Session, lastMatchedIndex int, request []byte, chunks [][]byte) (int, float64, *recording.CallOutbound)

func (*Matcher) HasBetterScore

func (m *Matcher) HasBetterScore(score int, index int, maxScore int) bool

func (*Matcher) MatchOutboundTalk

func (m *Matcher) MatchOutboundTalk(
	ctx context.Context, session *replaying.Session, lastMatchedIndex int, request []byte) (int, float64, *recording.CallOutbound)

type MatcherIf

type MatcherIf interface {
	MatchOutboundTalk(ctx context.Context, session *replaying.Session, lastMatchedIndex int, request []byte) (int, float64, *recording.CallOutbound)
}

Jump to

Keyboard shortcuts

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