grpcutil

package
v0.15.7 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Overview

Package grpcutil contains functions for interacting with gRPC.

Index

Constants

View Source
const JWTMetadataKey = "jwt"

JWTMetadataKey is the key in the metadata.

View Source
const MetadataKeyEnvoyVersion = "x-envoy-version"

MetadataKeyEnvoyVersion is the gRPC metadata key used for the envoy version.

View Source
const MetadataKeyPomeriumVersion = "x-pomerium-version"

MetadataKeyPomeriumVersion is the gRPC metadata key used for the pomerium version.

View Source
const SessionIDMetadataKey = "sessionid"

SessionIDMetadataKey is the key in the metadata.

Variables

This section is empty.

Functions

func AttachMetadataInterceptors added in v0.11.0

func AttachMetadataInterceptors(md metadata.MD) (grpc.UnaryServerInterceptor, grpc.StreamServerInterceptor)

AttachMetadataInterceptors returns unary and server stream interceptors that attach metadata to the response.

func GetPeerAddr added in v0.14.0

func GetPeerAddr(ctx context.Context) string

GetPeerAddr returns the peer address.

func GetTypeURL added in v0.14.0

func GetTypeURL(msg proto.Message) string

GetTypeURL gets the TypeURL for a protobuf message.

func JWTFromGRPCRequest

func JWTFromGRPCRequest(ctx context.Context) (rawjwt string, ok bool)

JWTFromGRPCRequest returns the JWT from the gRPC request.

func RequireSignedJWT added in v0.11.0

func RequireSignedJWT(ctx context.Context, key []byte) error

RequireSignedJWT requires a JWT in the gRPC metadata and that it be signed by the given key.

func SessionIDFromGRPCRequest

func SessionIDFromGRPCRequest(ctx context.Context) (sessionID string, ok bool)

SessionIDFromGRPCRequest returns the session id from the gRPC request.

func StreamRequireSignedJWT added in v0.11.0

func StreamRequireSignedJWT(key string) grpc.StreamServerInterceptor

StreamRequireSignedJWT requires a JWT in the gRPC metadata and that it be signed by the base64-encoded key.

func UnaryRequireSignedJWT added in v0.11.0

func UnaryRequireSignedJWT(key string) grpc.UnaryServerInterceptor

UnaryRequireSignedJWT requires a JWT in the gRPC metadata and that it be signed by the base64-encoded key.

func WithOutgoingJWT

func WithOutgoingJWT(ctx context.Context, rawjwt string) context.Context

WithOutgoingJWT appends a metadata header for the JWT to a context.

func WithOutgoingSessionID

func WithOutgoingSessionID(ctx context.Context, sessionID string) context.Context

WithOutgoingSessionID appends a metadata header for the session ID to a context.

func WithStreamSignedJWT added in v0.11.0

func WithStreamSignedJWT(key []byte) grpc.StreamClientInterceptor

WithStreamSignedJWT returns a StreamClientInterceptor that adds a JWT to requests.

func WithUnarySignedJWT added in v0.11.0

func WithUnarySignedJWT(key []byte) grpc.UnaryClientInterceptor

WithUnarySignedJWT returns a UnaryClientInterceptor that adds a JWT to requests.

Types

This section is empty.

Jump to

Keyboard shortcuts

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