[#607] network: Rename Address.HostAddrString method to HostAddr
Return tyype is clear from the method's signature and docs, there is no point in reflecting it in the name. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
35f81729e4
commit
47fe8911a3
6 changed files with 10 additions and 10 deletions
|
@ -258,7 +258,7 @@ func getSDKClient(key *ecdsa.PrivateKey) (client.Client, error) {
|
|||
}
|
||||
|
||||
options := []client.Option{
|
||||
client.WithAddress(netAddr.HostAddrString()),
|
||||
client.WithAddress(netAddr.HostAddr()),
|
||||
client.WithDefaultPrivateKey(key),
|
||||
}
|
||||
|
||||
|
|
|
@ -63,10 +63,10 @@ func (a Address) IPAddrString() (string, error) {
|
|||
return ip.String(), nil
|
||||
}
|
||||
|
||||
// HostAddrString returns host address in string format.
|
||||
// HostAddr returns host address in string format.
|
||||
//
|
||||
// Panics if host address cannot be fetched from Address.
|
||||
func (a Address) HostAddrString() string {
|
||||
func (a Address) HostAddr() string {
|
||||
_, host, err := manet.DialArgs(a.ma)
|
||||
if err != nil {
|
||||
// the only correct way to construct Address is AddressFromString
|
||||
|
|
|
@ -62,7 +62,7 @@ func TestAddress_HostAddrString(t *testing.T) {
|
|||
for _, testcase := range testcases {
|
||||
addr := Address{testcase.ma}
|
||||
|
||||
got := addr.HostAddrString()
|
||||
got := addr.HostAddr()
|
||||
|
||||
require.Equal(t, testcase.exp, got)
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ func TestAddress_HostAddrString(t *testing.T) {
|
|||
|
||||
for _, testcase := range testcases {
|
||||
addr := Address{testcase}
|
||||
require.Panics(t, func() { addr.HostAddrString() })
|
||||
require.Panics(t, func() { addr.HostAddr() })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
2
pkg/network/cache/client.go
vendored
2
pkg/network/cache/client.go
vendored
|
@ -54,7 +54,7 @@ func (c *ClientCache) Get(netAddr *network.Address) (client.Client, error) {
|
|||
return cli, nil
|
||||
}
|
||||
|
||||
opts := append(c.opts, client.WithAddress(netAddr.HostAddrString()))
|
||||
opts := append(c.opts, client.WithAddress(netAddr.HostAddr()))
|
||||
|
||||
if netAddr.TLSEnabled() {
|
||||
opts = append(opts, client.WithTLSConfig(&tls.Config{}))
|
||||
|
|
|
@ -83,7 +83,7 @@ func (p *testPlacementBuilder) BuildPlacement(addr *objectSDK.Address, _ *netmap
|
|||
}
|
||||
|
||||
func (c *testClientCache) get(mAddr *network.Address) (getClient, error) {
|
||||
v, ok := c.clients[mAddr.HostAddrString()]
|
||||
v, ok := c.clients[mAddr.HostAddr()]
|
||||
if !ok {
|
||||
return nil, errors.New("could not construct client")
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ func testNodeMatrix(t testing.TB, dim []int) ([]netmap.Nodes, [][]string) {
|
|||
na, err := network.AddressFromString(a)
|
||||
require.NoError(t, err)
|
||||
|
||||
as[j] = na.HostAddrString()
|
||||
as[j] = na.HostAddr()
|
||||
|
||||
ni := netmap.NewNodeInfo()
|
||||
ni.SetAddress(a)
|
||||
|
|
|
@ -85,7 +85,7 @@ func (p *testPlacementBuilder) BuildPlacement(addr *objectSDK.Address, _ *netmap
|
|||
}
|
||||
|
||||
func (c *testClientCache) get(mAddr *network.Address) (searchClient, error) {
|
||||
v, ok := c.clients[mAddr.HostAddrString()]
|
||||
v, ok := c.clients[mAddr.HostAddr()]
|
||||
if !ok {
|
||||
return nil, errors.New("could not construct client")
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ func testNodeMatrix(t testing.TB, dim []int) ([]netmap.Nodes, [][]string) {
|
|||
na, err := network.AddressFromString(a)
|
||||
require.NoError(t, err)
|
||||
|
||||
as[j] = na.HostAddrString()
|
||||
as[j] = na.HostAddr()
|
||||
|
||||
ni := netmap.NewNodeInfo()
|
||||
ni.SetAddress(a)
|
||||
|
|
Loading…
Reference in a new issue