[#607] network: Do not return error from Address.HostAddrString method

Panic if internal `manet.DialArgs` call returns error since this is
unexpected according to `AddressFromString` implementation.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-06-16 14:08:07 +03:00 committed by Leonard Lyubich
parent 4c2d8d5ac9
commit 35f81729e4
6 changed files with 15 additions and 36 deletions

View file

@ -2,7 +2,6 @@ package cache
import (
"crypto/tls"
"fmt"
"sync"
"github.com/nspcc-dev/neofs-api-go/pkg/client"
@ -55,12 +54,7 @@ func (c *ClientCache) Get(netAddr *network.Address) (client.Client, error) {
return cli, nil
}
hostAddr, err := netAddr.HostAddrString()
if err != nil {
return nil, fmt.Errorf("could not parse address as a string: %w", err)
}
opts := append(c.opts, client.WithAddress(hostAddr))
opts := append(c.opts, client.WithAddress(netAddr.HostAddrString()))
if netAddr.TLSEnabled() {
opts = append(opts, client.WithTLSConfig(&tls.Config{}))