[#1351] cli: Fix connection scheme loss during endpoint parsing
In previous implementation NeoFS CLI app used `network.Address.HostAddr` as a server URI, which caused scheme loss since host address doesn't contain it. Rename `HostAddr` to `URIAddr` and make it to return URI address with `grpcs` scheme if TLS is enabled. Make `TLSEnabled` unexported since it was used to provide default `tls.Config` only (it is used by default in SDK). Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
3a44010180
commit
cd545f0160
11 changed files with 39 additions and 53 deletions
|
@ -89,12 +89,10 @@ func TestNodeSection(t *testing.T) {
|
|||
expectedAddr := []struct {
|
||||
str string
|
||||
host string
|
||||
tls bool
|
||||
}{
|
||||
{
|
||||
str: "/dns4/localhost/tcp/8083/tls",
|
||||
host: "localhost:8083",
|
||||
tls: true,
|
||||
host: "grpcs://localhost:8083",
|
||||
},
|
||||
{
|
||||
str: "/dns4/s01.neofs.devenv/tcp/8080",
|
||||
|
@ -118,8 +116,7 @@ func TestNodeSection(t *testing.T) {
|
|||
|
||||
addrs.IterateAddresses(func(addr network.Address) bool {
|
||||
require.Equal(t, expectedAddr[ind].str, addr.String())
|
||||
require.Equal(t, expectedAddr[ind].host, addr.HostAddr())
|
||||
require.Equal(t, expectedAddr[ind].tls, addr.TLSEnabled())
|
||||
require.Equal(t, expectedAddr[ind].host, addr.URIAddr())
|
||||
|
||||
ind++
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue