grpcutil

package module
Version: v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: CC0-1.0 Imports: 7 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertError

func ConvertError(err error) error

ConvertError checks whether err is a gRPC error representing a common go error. If so, returns the go error, otherwise returns err.

func NewClientTLS

func NewClientTLS(crt []byte) credentials.TransportCredentials

NewClientTLS constructs TLS credentials from the input certificate for client. That is, crt is the contents of the *.crt file. Note that this will attempt to start with the system cert pool if possible.

func NewServerTLS

func NewServerTLS(crt []byte, key []byte) (credentials.TransportCredentials, error)

NewServerTLS constructs TLS credentials from the input certificate and key for server. That is, crt is the contents of the *.crt file, and key is the contents of the *.key file.

Types

type Server

type Server interface {
	// Serve accepts incoming connections on the listener lis. Serve returns
	// when lis.Accept fails with fatal errors. lis will be closed on return.
	// Serve will return a non-nil error unless Stop or GracefulStop is called.
	Serve(lis net.Listener) error
	// Stop stops the server. It immediately closes all open connections and
	// listeners.
	Stop()
	// GracefulStop stops the server gracefully. It stops the server from
	// accepting new connections and blocks until all pending tasks are
	// finished.
	GracefulStop()
}

Server is the interface that a gRPC server exposes to the public.

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL