Documentation
¶
Overview ¶
Package grpcutil contains functions for interacting with gRPC.
Index ¶
- Constants
- func AttachMetadataInterceptors(md metadata.MD) (grpc.UnaryServerInterceptor, grpc.StreamServerInterceptor)
- func GetPeerAddr(ctx context.Context) string
- func GetTypeURL(msg proto.Message) string
- func JWTFromGRPCRequest(ctx context.Context) (rawjwt string, ok bool)
- func RequireSignedJWT(ctx context.Context, key []byte) error
- func SessionIDFromGRPCRequest(ctx context.Context) (sessionID string, ok bool)
- func StreamRequireSignedJWT(key string) grpc.StreamServerInterceptor
- func UnaryRequireSignedJWT(key string) grpc.UnaryServerInterceptor
- func WithOutgoingJWT(ctx context.Context, rawjwt string) context.Context
- func WithOutgoingSessionID(ctx context.Context, sessionID string) context.Context
- func WithStreamSignedJWT(key []byte) grpc.StreamClientInterceptor
- func WithUnarySignedJWT(key []byte) grpc.UnaryClientInterceptor
Constants ¶
const JWTMetadataKey = "jwt"
JWTMetadataKey is the key in the metadata.
const MetadataKeyEnvoyVersion = "x-envoy-version"
MetadataKeyEnvoyVersion is the gRPC metadata key used for the envoy version.
const MetadataKeyPomeriumVersion = "x-pomerium-version"
MetadataKeyPomeriumVersion is the gRPC metadata key used for the pomerium version.
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
GetPeerAddr returns the peer address.
func GetTypeURL ¶ added in v0.14.0
GetTypeURL gets the TypeURL for a protobuf message.
func JWTFromGRPCRequest ¶
JWTFromGRPCRequest returns the JWT from the gRPC request.
func RequireSignedJWT ¶ added in v0.11.0
RequireSignedJWT requires a JWT in the gRPC metadata and that it be signed by the given key.
func SessionIDFromGRPCRequest ¶
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 ¶
WithOutgoingJWT appends a metadata header for the JWT to a context.
func WithOutgoingSessionID ¶
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.