grpc

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package grpc provides gRPC utility functions, complementing the more common ones in the github.com/grpc/grpc-go package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGRPCClientConn

func NewGRPCClientConn(opts *Options) (*grpc.ClientConn, error)

NewGRPCClientConn returns a new gRPC pomerium service client connection.

func NewServer

func NewServer(opt *ServerOptions, registrationFn func(s *grpc.Server), wg *sync.WaitGroup) (*grpc.Server, error)

NewServer creates a new gRPC serve. It is the callers responsibility to close the resturned server.

func Shutdown

func Shutdown(srv *grpc.Server)

Shutdown attempts to shut down the server when a os interrupt or sigterm signal are received without interrupting any active connections. Shutdown stops the server from accepting new connections and RPCs and blocks until all the pending RPCs are finished.

Types

type Options

type Options struct {
	// Addr is the location of the service.  e.g. "service.corp.example:8443"
	Addr *url.URL
	// OverrideCertificateName overrides the server name used to verify the hostname on the
	// returned certificates from the server. gRPC internals also use it to override the virtual
	// hosting name if it is set.
	OverrideCertificateName string
	// CA specifies the base64 encoded TLS certificate authority to use.
	CA string
	// CAFile specifies the TLS certificate authority file to use.
	CAFile string
	// RequestTimeout specifies the timeout for individual RPC calls
	RequestTimeout time.Duration
	// ClientDNSRoundRobin enables or disables DNS resolver based load balancing
	ClientDNSRoundRobin bool

	// WithInsecure disables transport security for this ClientConn.
	// Note that transport security is required unless WithInsecure is set.
	WithInsecure bool

	// ServiceName specifies the service name for telemetry exposition
	ServiceName string
}

Options contains options for connecting to a pomerium rpc service.

type ServerOptions

type ServerOptions struct {
	// Addr specifies the host and port on which the server should serve
	// gRPC requests. If empty, ":443" is used.
	Addr string

	// TLS certificates to use, if any.
	TLSCertificate []tls.Certificate

	// InsecureServer when enabled disables all transport security.
	// In this mode, Pomerium is susceptible to man-in-the-middle attacks.
	// This should be used only for testing.
	InsecureServer bool

	// KeepaliveParams sets GRPC keepalive.ServerParameters
	KeepaliveParams keepalive.ServerParameters

	// ServiceName specifies the service name for telemetry exposition
	ServiceName string
}

ServerOptions contains the configurations settings for a gRPC server.

Directories

Path Synopsis
client
Package client implements a gRPC client for the authorization service.
Package client implements a gRPC client for the authorization service.
client
Package client implements a gRPC client for the cache service.
Package client implements a gRPC client for the cache service.

Jump to

Keyboard shortcuts

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