grpc

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultCallTimeout is the default call timeout.
	DefaultCallTimeout = 60 * time.Second
	// DefaultConnectTimeout is the default connect timeout.
	DefaultConnectTimeout = 10 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	Invoke(fileDescriptorSets []*descriptor.FileDescriptorSet, address string, method string, inputReader io.Reader, outputWriter io.Writer) error
}

Handler handles gRPC calls.

func NewHandler

func NewHandler(options ...HandlerOption) Handler

NewHandler returns a new Handler.

type HandlerOption

type HandlerOption func(*handler)

HandlerOption is an option for a new Handler.

func HandlerWithCallTimeout

func HandlerWithCallTimeout(callTimeout time.Duration) HandlerOption

HandlerWithCallTimeout returns a HandlerOption that has the given call timeout.

Each invocation must be completed within this time.

The default is to use DefaultCallTimeout.

func HandlerWithConnectTimeout

func HandlerWithConnectTimeout(connectTimeout time.Duration) HandlerOption

HandlerWithConnectTimeout returns a HandlerOption that has the given connect timeout.

The default is to use DefaultConnectTimeout.

func HandlerWithDetails

func HandlerWithDetails() HandlerOption

HandlerWithDetails returns a HandlerOption that outputs responses in a structured JSON message that includes headers, trailers, and statuses.

The default is to just print the responses.

func HandlerWithHeader

func HandlerWithHeader(key string, value string) HandlerOption

HandlerWithHeader returns a HandlerOption that adds the given key/value header.

func HandlerWithKeepaliveTime

func HandlerWithKeepaliveTime(keepaliveTime time.Duration) HandlerOption

HandlerWithKeepaliveTime returns a HandlerOption that has the given keepalive time.

The default is to have no keepalive time.

func HandlerWithLogger

func HandlerWithLogger(logger *zap.Logger) HandlerOption

HandlerWithLogger returns a HandlerOption that uses the given logger.

The default is to use zap.NewNop().

func HandlerWithTLS

func HandlerWithTLS(insecure bool, cacert string, cert string, key string, serverName string) HandlerOption

HandlerWithTLS returns a HandlerOption that enables TLS connections to the remote host with the given configuration attributes.

Jump to

Keyboard shortcuts

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