Documentation ¶
Index ¶
- Constants
- func AddMetadataToContext(ctx context.Context, raw map[string]string) context.Context
- func ClientVersionFromContext(ctx context.Context) (string, bool)
- func SessionRecordingFormatFromContext(ctx context.Context) string
- func StreamClientInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, ...) (grpc.ClientStream, error)
- func StreamServerInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, ...) error
- func UnaryClientInterceptor(ctx context.Context, method string, req, reply interface{}, ...) error
- func UnaryServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (resp interface{}, err error)
- func UserAgentFromContext(ctx context.Context) string
- func VersionFromMetadata(md metadata.MD) (string, bool)
- func WithSessionRecordingFormatContext(ctx context.Context, format string) context.Context
- func WithUserAgentFromTeleportComponent(component string) grpc.DialOption
- type DisableInterceptors
Constants ¶
const ( VersionKey = "version" SessionRecordingFormatContextKey = "session-recording-format" )
Variables ¶
This section is empty.
Functions ¶
func AddMetadataToContext ¶
AddMetadataToContext returns a new context copied from ctx with the given raw metadata added. Metadata already set on the given context for any key will not be overridden, but new key/value pairs will always be added.
func ClientVersionFromContext ¶
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 SessionRecordingFormatFromContext ¶
SessionRecordingFormatFromContext returns the format of the accessed session recording (if present).
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.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)
UnaryServerInterceptor intercepts a gRPC server unary call and adds default metadata to the context.
func UserAgentFromContext ¶
UserAgentFromContext returns the user agent from GRPC client metadata.
func VersionFromMetadata ¶
VersionFromMetadata attempts to extract the standard version metadata value that is added to client and server headers by the interceptors in this package.
func WithSessionRecordingFormatContext ¶
WithSessionRecordingFormatContext returns a context.Context containing the format of the accessed session recording.
func WithUserAgentFromTeleportComponent ¶
func WithUserAgentFromTeleportComponent(component string) grpc.DialOption
WithUserAgentFromTeleportComponent returns a grpc.DialOption that reports the Teleport component and the API version for user agent.
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).