move useful options to micro repo

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2020-12-15 11:56:11 +03:00
parent 36040a5765
commit a149084e9a
4 changed files with 7 additions and 64 deletions

View File

@@ -3,7 +3,6 @@ package grpc
import (
"context"
"crypto/tls"
"net"
"github.com/unistack-org/micro/v3/server"
"google.golang.org/grpc"
@@ -12,9 +11,7 @@ import (
type codecsKey struct{}
type grpcOptions struct{}
type netListener struct{}
type maxMsgSizeKey struct{}
type maxConnKey struct{}
type tlsAuth struct{}
type reflectionKey struct{}
@@ -38,16 +35,6 @@ func AuthTLS(t *tls.Config) server.Option {
return setServerOption(tlsAuth{}, t)
}
// MaxConn specifies maximum number of max simultaneous connections to server
func MaxConn(n int) server.Option {
return setServerOption(maxConnKey{}, n)
}
// Listener specifies the net.Listener to use instead of the default
func Listener(l net.Listener) server.Option {
return setServerOption(netListener{}, l)
}
// Options to be used to configure gRPC options
func Options(opts ...grpc.ServerOption) server.Option {
return setServerOption(grpcOptions{}, opts)