@@ -14,9 +14,9 @@ import (
14
14
"google.golang.org/grpc/health/grpc_health_v1"
15
15
)
16
16
17
- func dialGRPCConn (tls * tls.Config , dialer func (string , time.Duration ) (net.Conn , error )) (* grpc.ClientConn , error ) {
17
+ func dialGRPCConn (tls * tls.Config , dialer func (string , time.Duration ) (net.Conn , error ), dialOpts ... grpc. DialOption ) (* grpc.ClientConn , error ) {
18
18
// Build dialing options.
19
- opts := make ([]grpc.DialOption , 0 , 5 )
19
+ opts := make ([]grpc.DialOption , 0 )
20
20
21
21
// We use a custom dialer so that we can connect over unix domain sockets.
22
22
opts = append (opts , grpc .WithDialer (dialer ))
@@ -37,6 +37,8 @@ func dialGRPCConn(tls *tls.Config, dialer func(string, time.Duration) (net.Conn,
37
37
grpc .WithDefaultCallOptions (grpc .MaxCallRecvMsgSize (math .MaxInt32 )),
38
38
grpc .WithDefaultCallOptions (grpc .MaxCallSendMsgSize (math .MaxInt32 )))
39
39
40
+ opts = append (opts , dialOpts ... )
41
+
40
42
// Connect. Note the first parameter is unused because we use a custom
41
43
// dialer that has the state to see the address.
42
44
conn , err := grpc .Dial ("unused" , opts ... )
@@ -50,7 +52,7 @@ func dialGRPCConn(tls *tls.Config, dialer func(string, time.Duration) (net.Conn,
50
52
// newGRPCClient creates a new GRPCClient. The Client argument is expected
51
53
// to be successfully started already with a lock held.
52
54
func newGRPCClient (doneCtx context.Context , c * Client ) (* GRPCClient , error ) {
53
- conn , err := dialGRPCConn (c .config .TLSConfig , c .dialer )
55
+ conn , err := dialGRPCConn (c .config .TLSConfig , c .dialer , c . config . DialOptions ... )
54
56
if err != nil {
55
57
return nil , err
56
58
}
0 commit comments