Documentation ¶
Index ¶
- Constants
- func CreateLengthPrefixedMessageFromPayload(data []byte) models.GrpcLengthPrefixedMessage
- func CreatePayloadFromLengthPrefixedMessage(msg models.GrpcLengthPrefixedMessage) ([]byte, error)
- func ExtractHeaders(frame *http2.HeadersFrame, decoder *hpack.Decoder) (pseudoHeaders, ordinaryHeaders map[string]string, err error)
- func FilterMocksBasedOnGrpcRequest(grpcReq models.GrpcReq, hook *hooks.Hook) (*models.Mock, error)
- func FilterMocksRelatedToGrpc(mocks []*models.Mock) []*models.Mock
- func NewDecoder() *hpack.Decoder
- func NewTranscoder(framer *http2.Framer, logger *zap.Logger, h *hooks.Hook) *transcoder
- func PrintDataFrame(frame *http2.DataFrame)
- func PrintFrame(frame http2.Frame)
- func PrintHeadersFrame(frame *http2.HeadersFrame)
- func PrintPingFrame(frame *http2.PingFrame)
- func PrintSettingsFrame(frame *http2.SettingsFrame)
- func PrintWindowUpdateFrame(frame *http2.WindowUpdateFrame)
- func TransferFrame(lhs net.Conn, rhs net.Conn, sic *StreamInfoCollection, isReqFromClient bool, ...) error
- type GrpcParser
- type StreamInfoCollection
- func (sic *StreamInfoCollection) AddHeadersForRequest(streamID uint32, headers map[string]string, isPseudo bool)
- func (sic *StreamInfoCollection) AddHeadersForResponse(streamID uint32, headers map[string]string, isPseudo, isTrailer bool)
- func (sic *StreamInfoCollection) AddPayloadForRequest(streamID uint32, payload []byte)
- func (sic *StreamInfoCollection) AddPayloadForResponse(streamID uint32, payload []byte)
- func (sic *StreamInfoCollection) FetchRequestForStream(streamID uint32) models.GrpcReq
- func (sic *StreamInfoCollection) InitialiseStream(streamID uint32)
- func (sic *StreamInfoCollection) PersistMockForStream(streamID uint32, ctx context.Context)
- func (sic *StreamInfoCollection) ResetStream(streamID uint32)
Constants ¶
View Source
const ( KLabelForAuthority = ":authority" KLabelForMethod = ":method" KLabelForPath = ":path" KLabelForScheme = ":http" KLabelForContentType = "content-type" )
View Source
const (
KmaxDynamicTableSize = 2048
)
Variables ¶
This section is empty.
Functions ¶
func CreateLengthPrefixedMessageFromPayload ¶
func CreateLengthPrefixedMessageFromPayload(data []byte) models.GrpcLengthPrefixedMessage
func CreatePayloadFromLengthPrefixedMessage ¶
func CreatePayloadFromLengthPrefixedMessage(msg models.GrpcLengthPrefixedMessage) ([]byte, error)
func ExtractHeaders ¶
func NewDecoder ¶
func NewTranscoder ¶
func PrintDataFrame ¶
func PrintFrame ¶
func PrintHeadersFrame ¶
func PrintHeadersFrame(frame *http2.HeadersFrame)
func PrintPingFrame ¶
func PrintSettingsFrame ¶
func PrintSettingsFrame(frame *http2.SettingsFrame)
func PrintWindowUpdateFrame ¶
func PrintWindowUpdateFrame(frame *http2.WindowUpdateFrame)
Types ¶
type GrpcParser ¶
type GrpcParser struct {
// contains filtered or unexported fields
}
func NewGrpcParser ¶
func NewGrpcParser(logger *zap.Logger, h *hooks.Hook) *GrpcParser
func (*GrpcParser) OutgoingType ¶
func (g *GrpcParser) OutgoingType(buffer []byte) bool
OutgoingType will be a method of GrpcParser.
func (*GrpcParser) ProcessOutgoing ¶
type StreamInfoCollection ¶
type StreamInfoCollection struct { StreamInfo map[uint32]models.GrpcStream ReqTimestampMock time.Time ResTimestampMock time.Time // contains filtered or unexported fields }
StreamInfoCollection is a thread-safe data structure to store all communications that happen in a stream for grpc. This includes the headers and data frame for the request and response.
func NewStreamInfoCollection ¶
func NewStreamInfoCollection(h *hooks.Hook) *StreamInfoCollection
func (*StreamInfoCollection) AddHeadersForRequest ¶
func (sic *StreamInfoCollection) AddHeadersForRequest(streamID uint32, headers map[string]string, isPseudo bool)
func (*StreamInfoCollection) AddHeadersForResponse ¶
func (sic *StreamInfoCollection) AddHeadersForResponse(streamID uint32, headers map[string]string, isPseudo, isTrailer bool)
func (*StreamInfoCollection) AddPayloadForRequest ¶
func (sic *StreamInfoCollection) AddPayloadForRequest(streamID uint32, payload []byte)
AddPayloadForRequest adds the DATA frame to the stream. A data frame always appears after at least one header frame. Hence, we implicitly assume that the stream has been initialised.
func (*StreamInfoCollection) AddPayloadForResponse ¶
func (sic *StreamInfoCollection) AddPayloadForResponse(streamID uint32, payload []byte)
AddPayloadForResponse adds the DATA frame to the stream. A data frame always appears after at least one header frame. Hence, we implicitly assume that the stream has been initialised.
func (*StreamInfoCollection) FetchRequestForStream ¶
func (sic *StreamInfoCollection) FetchRequestForStream(streamID uint32) models.GrpcReq
func (*StreamInfoCollection) InitialiseStream ¶
func (sic *StreamInfoCollection) InitialiseStream(streamID uint32)
func (*StreamInfoCollection) PersistMockForStream ¶
func (sic *StreamInfoCollection) PersistMockForStream(streamID uint32, ctx context.Context)
func (*StreamInfoCollection) ResetStream ¶
func (sic *StreamInfoCollection) ResetStream(streamID uint32)
Click to show internal directories.
Click to hide internal directories.