grpc

package
v3.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package grpc contains gRPC functionality for Martian proxy.

Index

Constants

This section is empty.

Variables

This section is empty.

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.

Jump to

Keyboard shortcuts

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