grpcclientidentity

package
v0.3.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package grpcclientidentity makes the client identity provided by github.com/zrepl/zrepl/daemon/transport/serve.{AuthenticatedListener,AuthConn} available to gRPC service handlers.

This goal is achieved through the combination of custom gRPC transport credentials and two interceptors (i.e. middleware).

For gRPC clients, the TransportCredentials + Dialer can be used to construct a gRPC client (grpc.ClientConn) that uses a github.com/zrepl/zrepl/daemon/transport/connect.Connecter to connect to a server.

The adaptors exposed by this package must be used together, and panic if they are not. See package grpchelper for a more restrictive but safe example on how the adaptors should be composed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInterceptors

func NewInterceptors(logger Logger, clientIdentityKey interface{}, interceptor Interceptor) (unary grpc.UnaryServerInterceptor, stream grpc.StreamServerInterceptor)

func NewTransportCredentials

func NewTransportCredentials(log Logger) credentials.TransportCredentials

Use on both sides as ServerOption or ClientOption.

Types

type ContextInterceptorData added in v0.3.0

type ContextInterceptorData interface {
	FullMethod() string
	ClientIdentity() string
}

type GRPCDialFunction

type GRPCDialFunction = func(string, time.Duration) (net.Conn, error)

func NewDialer

func NewDialer(logger Logger, connecter transport.Connecter) GRPCDialFunction

type Interceptor added in v0.3.0

type Interceptor = func(ctx context.Context, data ContextInterceptorData, handler func(ctx context.Context))

type Logger

type Logger = logger.Logger

Directories

Path Synopsis
This package demonstrates how the grpcclientidentity package can be used to set up a gRPC greeter service.
This package demonstrates how the grpcclientidentity package can be used to set up a gRPC greeter service.
pdu
Package grpchelper wraps the adaptors implemented by package grpcclientidentity into a less flexible API which, however, ensures that the individual adaptor primitive's expectations are met and hence do not panic.
Package grpchelper wraps the adaptors implemented by package grpcclientidentity into a less flexible API which, however, ensures that the individual adaptor primitive's expectations are met and hence do not panic.

Jump to

Keyboard shortcuts

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