[#23] Remove usage of deprecated code elements in API Go v1.28.2

Remove usage of deprecated `NodeInfo.Address` method. Replace it with new
methods which work with group of addresses.
This commit is contained in:
Leonard Lyubich 2021-07-06 12:20:23 +03:00
parent 0aa14a6d82
commit 9c906987ca

View file

@ -13,6 +13,7 @@ import (
"github.com/nspcc-dev/neofs-api-go/pkg/client"
"github.com/nspcc-dev/neofs-api-go/pkg/container"
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
"github.com/nspcc-dev/neofs-api-go/pkg/netmap"
"github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/nspcc-dev/neofs-api-go/pkg/owner"
"github.com/nspcc-dev/neofs-api-go/pkg/session"
@ -103,11 +104,21 @@ func newPool(ctx context.Context, options *BuilderOptions) (Pool, error) {
}
st, err := c.CreateSession(ctx, options.SessionExpirationEpoch)
if err != nil {
address := "unknown"
var address interface{} = "unknown"
if epi, err := c.EndpointInfo(ctx); err == nil {
address = epi.NodeInfo().Address()
ni := epi.NodeInfo()
addresses := make([]string, 0, ni.NumberOfAddresses())
netmap.IterateAllAddresses(ni, func(addr string) {
addresses = append(addresses, addr)
})
address = addresses
}
return nil, fmt.Errorf("failed to create neofs session token for client %s: %w", address, err)
return nil, fmt.Errorf("failed to create neofs session token for client %v: %w", address, err)
}
clientPacks[i] = &clientPack{client: c, sessionToken: st, healthy: true}
}