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 ¶
- func NewInterceptors(logger Logger, clientIdentityKey interface{}, interceptor Interceptor) (unary grpc.UnaryServerInterceptor, stream grpc.StreamServerInterceptor)
- func NewTransportCredentials(log Logger) credentials.TransportCredentials
- type ContextInterceptorData
- type GRPCDialFunction
- type Interceptor
- type Logger
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 GRPCDialFunction ¶
type Interceptor ¶ added in v0.3.0
type Interceptor = func(ctx context.Context, data ContextInterceptorData, handler func(ctx context.Context))
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. |
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. |