mirror of
https://github.com/linka-cloud/grpc.git
synced 2025-06-22 09:12:28 +00:00
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:
@ -1,6 +1,8 @@
|
||||
package interceptors
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
@ -18,3 +20,16 @@ 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
|
||||
}
|
||||
|
Reference in New Issue
Block a user