[#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:
parent
0aa14a6d82
commit
9c906987ca
1 changed files with 14 additions and 3 deletions
|
@ -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}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue