package grpc

import "github.com/google/martian/v3/h2/grpc"

Package grpc contains gRPC functionality for Martian proxy.

Index

Functions

func AsStreamProcessorFactory

func AsStreamProcessorFactory(f ProcessorFactory) h2.StreamProcessorFactory

AsStreamProcessorFactory converts a ProcessorFactory into a StreamProcessorFactory. It creates an adapter that abstracts HTTP/2 frames into a representation that is closer to gRPC.

Types

type Encoding

type Encoding uint8

Encoding is the grpc-encoding type. See Content-Coding entry at: https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests

const (
	// Identity indicates that no compression is used.
	Identity Encoding = iota
	// Gzip indicates that Gzip compression is used.
	Gzip
	// Deflate indicates that Deflate compression is used.
	Deflate
	// Snappy indicates that Snappy compression is used.
	Snappy
)

type Processor

type Processor interface {
	h2.HeaderProcessor
	// Message receives serialized messages.
	Message(data []byte, streamEnded bool) error
}

Processor processes gRPC traffic.

type ProcessorFactory

type ProcessorFactory func(url *url.URL, server, client Processor) (Processor, Processor)

ProcessorFactory creates gRPC processors that implement the Processor interface, which abstracts away some of the details of the underlying HTTP/2 protocol. A processor must forward invocations to the given `server` or `client` processors, which will arrange to have the data forwarded to the destination, with possible edits. Nil values are safe to return and no processing occurs in such cases. NOTE: an interface may have a non-nil type with a nil value. Such values are treated as valid processors.

Source Files

grpc.go

Version
v3.3.3 (latest)
Published
Aug 16, 2022
Platform
darwin/amd64
Imports
12 packages
Last checked
3 hours ago

Tools for package owners.