metadata

package
v0.0.0-...-9a5b211 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2023 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientVersionFromContext

func ClientVersionFromContext(ctx context.Context) (string, bool)

ClientVersionFromContext can be called from a GRPC server method to return the client version that was added to the GRPC metadata by StreamClientInterceptor or UnaryClientInterceptor on the client.

func StreamClientInterceptor

func StreamClientInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error)

StreamClientInterceptor intercepts a GRPC client stream call and adds default metadata to the context.

func StreamServerInterceptor

func StreamServerInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

StreamServerInterceptor intercepts a GRPC client stream call and adds default metadata to the context.

func UnaryClientInterceptor

func UnaryClientInterceptor(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error

UnaryClientInterceptor intercepts a GRPC client unary call and adds default metadata to the context.

Types

type DisableInterceptors

type DisableInterceptors struct{}

DisableInterceptors can be set on the client context with context.WithValue(ctx, DisableInterceptors{}, struct{}{}) to stop the client interceptors from adding any metadata to the context (useful for testing).

Jump to

Keyboard shortcuts

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