interceptors: add ban

health: set services serving on start and not available on close

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
2022-09-27 17:06:18 +02:00
parent 9bf4e691ce
commit c7096975b1
13 changed files with 350 additions and 22 deletions

View File

@ -35,19 +35,6 @@ func (f *forward) StreamServerInterceptor() grpc.StreamServerInterceptor {
if md2, ok := metadata.FromOutgoingContext(ctx); ok {
o = metadata.Join(o, md2.Copy())
}
return handler(srv, NewContextServerStream(metadata.NewOutgoingContext(ctx, o), ss))
return handler(srv, interceptors.NewContextServerStream(metadata.NewOutgoingContext(ctx, o), ss))
}
}
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
}