File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -45,12 +45,14 @@ func (e *GRPC) Init(
4545
4646type Clients map [string ]ServerParams
4747
48- func (cs Clients ) makeClient (key string ) * grpc.ClientConn {
48+ func (cs Clients ) makeClient (key string , opts ... grpc. DialOption ) * grpc.ClientConn {
4949 params , ok := cs [key ]
5050 if ! ok {
5151 return nil
5252 }
53- opts := make ([]grpc.DialOption , 0 )
53+ if opts == nil {
54+ opts = make ([]grpc.DialOption , 0 )
55+ }
5456 if params .CertFile != "" && params .KeyFile != "" {
5557 creds , err := credentials .NewClientTLSFromFile (params .CertFile , params .KeyFile )
5658 if err != nil {
@@ -66,13 +68,13 @@ func (cs Clients) makeClient(key string) *grpc.ClientConn {
6668 timeout .UnaryClientInterceptor (params .Timeout ),
6769 ))
6870 }
69- conn , err := grpc .Dial (params .Addr , opts ... )
71+ conn , err := grpc .NewClient (params .Addr , opts ... )
7072 if err != nil {
7173 return nil
7274 }
7375 return conn
7476}
7577
76- func (e * GRPC ) GetGRPCClient (key string ) * grpc.ClientConn {
77- return e .Clients .makeClient (key )
78+ func (e * GRPC ) GetGRPCClient (key string , opts ... grpc. DialOption ) * grpc.ClientConn {
79+ return e .Clients .makeClient (key , opts ... )
7880}
You can’t perform that action at this time.
0 commit comments