add unknown service handler

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2022-03-24 14:38:23 +03:00
parent dda5d46e47
commit b248593e35
2 changed files with 23 additions and 8 deletions

View File

@@ -9,10 +9,11 @@ import (
)
type (
codecsKey struct{}
grpcOptions struct{}
maxMsgSizeKey struct{}
reflectionKey struct{}
codecsKey struct{}
grpcOptions struct{}
maxMsgSizeKey struct{}
reflectionKey struct{}
unknownServiceHandlerKey struct{}
)
// gRPC Codec to be used to encode/decode requests for a given content type
@@ -37,8 +38,7 @@ func Options(opts ...grpc.ServerOption) server.Option {
//
// MaxMsgSize set the maximum message in bytes the server can receive and
// send. Default maximum message size is 4 MB.
//
// send. Default maximum message size is 4 MB.
func MaxMsgSize(s int) server.Option {
return server.SetOption(maxMsgSizeKey{}, s)
}
@@ -47,3 +47,8 @@ func MaxMsgSize(s int) server.Option {
func Reflection(b bool) server.Option {
return server.SetOption(reflectionKey{}, b)
}
// UnknownServiceHandler enables support for all services
func UnknownServiceHandler(h grpc.StreamHandler) server.Option {
return server.SetOption(unknownServiceHandlerKey{}, h)
}