forked from TrueCloudLab/frostfs-node
[#607] network: Return group-address client from ClientCache
Add group-address `Client` implementation. Return instances of this implementation from `ClientCache.Get` method. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
3805b0f638
commit
c82615667d
3 changed files with 338 additions and 27 deletions
12
pkg/network/cache/client.go
vendored
12
pkg/network/cache/client.go
vendored
|
@ -1,7 +1,6 @@
|
|||
package cache
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"sync"
|
||||
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/client"
|
||||
|
@ -54,16 +53,7 @@ func (c *ClientCache) Get(netAddr network.Address) (client.Client, error) {
|
|||
return cli, nil
|
||||
}
|
||||
|
||||
opts := append(c.opts, client.WithAddress(netAddr.HostAddr()))
|
||||
|
||||
if netAddr.TLSEnabled() {
|
||||
opts = append(opts, client.WithTLSConfig(&tls.Config{}))
|
||||
}
|
||||
|
||||
cli, err := client.New(opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cli := newMultiClient(network.GroupFromAddress(netAddr), c.opts)
|
||||
|
||||
c.clients[mAddr] = cli
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue