grpc/interceptors/interceptors.go
Adphi c7096975b1
interceptors: add ban
health: set services serving on start and not available on close

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
2022-09-27 17:06:18 +02:00

36 lines
730 B
Go

package interceptors
import (
"context"
"google.golang.org/grpc"
)
type ServerInterceptors interface {
UnaryServerInterceptor() grpc.UnaryServerInterceptor
StreamServerInterceptor() grpc.StreamServerInterceptor
}
type ClientInterceptors interface {
UnaryClientInterceptor() grpc.UnaryClientInterceptor
StreamClientInterceptor() grpc.StreamClientInterceptor
}
type Interceptors interface {
ServerInterceptors
ClientInterceptors
}
func NewContextServerStream(ctx context.Context, ss grpc.ServerStream) grpc.ServerStream {
return &ContextWrapper{ServerStream: ss, ctx: ctx}
}
type ContextWrapper struct {
grpc.ServerStream
ctx context.Context
}
func (w *ContextWrapper) Context() context.Context {
return w.ctx
}