From 10482ffbed3b7de6e49709dcdfa1447ee0176dd6 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 30 May 2023 16:48:51 +0300 Subject: [PATCH] [#82] client: Allow to pass gRPC dial options Signed-off-by: Dmitrii Stepanov --- client/client.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/client.go b/client/client.go index 601f557..3942390 100644 --- a/client/client.go +++ b/client/client.go @@ -10,6 +10,7 @@ import ( v2accounting "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" + "google.golang.org/grpc" ) // Client represents virtual connection to the FrostFS network to communicate @@ -101,6 +102,7 @@ func (c *Client) Dial(ctx context.Context, prm PrmDial) error { client.WithNetworkURIAddress(prm.endpoint, prm.tlsConfig), client.WithDialTimeout(prm.timeoutDial), client.WithRWTimeout(prm.streamTimeout), + client.WithGRPCDialOptions(prm.dialOptions), )...) c.setFrostFSAPIServer((*coreServer)(&c.c)) @@ -186,6 +188,8 @@ type PrmDial struct { streamTimeoutSet bool streamTimeout time.Duration + + dialOptions []grpc.DialOption } // SetServerURI sets server URI in the FrostFS network. @@ -226,3 +230,8 @@ func (x *PrmDial) SetStreamTimeout(timeout time.Duration) { x.streamTimeoutSet = true x.streamTimeout = timeout } + +// SetGRPCDialOptions sets the gRPC dial options for new gRPC client connection. +func (x *PrmDial) SetGRPCDialOptions(opts ...grpc.DialOption) { + x.dialOptions = opts +}