protocols

package
v0.0.0-...-59efaf5 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotExistsHeader    = errors.New("protocols: not exists header")
	ErrUnknownProtocolMsg = errors.New("protocols: unknown protocol msg")
)

Functions

func ProtoMessage

func ProtoMessage(req *Request, resp *Response) *pb.ProtoMessage

Types

type ProtoMatcher

type ProtoMatcher interface {
	MatchRequest(req *Request) *pb.ProtoMessage
	MatchResponse(resp *Response) *pb.ProtoMessage
}

type ProtoParser

type ProtoParser interface {
	ProtoType() types.ProtocolType
	ParseRequest(sockKey *types.SockKey, msg []byte) ([]ProtoRequest, error)
	EnableInferRequest() bool
	ParseResponse(sockKey *types.SockKey, msg []byte) ([]ProtoResponse, error)
	EnableInferResponse() bool
}

type ProtoRequest

type ProtoRequest interface {
	ProtoType() types.ProtocolType
	Protobuf() *pb.Request
}

type ProtoResponse

type ProtoResponse interface {
	ProtoType() types.ProtocolType
	Protobuf() *pb.Response
}

type Request

type Request struct {
	Timestamp uint64
	SockKey   types.SockKey
	Record    ProtoRequest
}

type Response

type Response struct {
	Timestamp uint64
	SockKey   types.SockKey
	Record    ProtoResponse
}

type UnknownParser

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

func NewUnknownParser

func NewUnknownParser(parsers []ProtoParser) *UnknownParser

func (*UnknownParser) EnableInferRequest

func (up *UnknownParser) EnableInferRequest() bool

func (*UnknownParser) EnableInferResponse

func (up *UnknownParser) EnableInferResponse() bool

func (*UnknownParser) ParseRequest

func (up *UnknownParser) ParseRequest(sockKey *types.SockKey, msg []byte) ([]ProtoRequest, error)

ParseRequest implements ProtoParser

func (*UnknownParser) ParseResponse

func (up *UnknownParser) ParseResponse(sockKey *types.SockKey, msg []byte) ([]ProtoResponse, error)

ParseResponse implements ProtoParser

func (*UnknownParser) ProtoType

func (*UnknownParser) ProtoType() types.ProtocolType

GetProtoType implements ProtoParser

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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