forked from TrueCloudLab/frostfs-node
[#607] network: Support URI address strings
Make Address.FromString method to parse URI addresses and enable TLS for TLS schemes. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
43eff09944
commit
6f861b6489
3 changed files with 45 additions and 5 deletions
|
@ -14,12 +14,15 @@ func TestAddress_TLSEnabled(t *testing.T) {
|
|||
{"/dns4/localhost/tcp/8080", false},
|
||||
{"/dns4/localhost/tcp/8080/tls", true},
|
||||
{"/tls/dns4/localhost/tcp/8080", true},
|
||||
{"grpc://localhost:8080", false},
|
||||
{"grpcs://localhost:8080", true},
|
||||
}
|
||||
|
||||
var addr Address
|
||||
|
||||
for _, test := range testCases {
|
||||
addr := Address{
|
||||
ma: buildMultiaddr(test.input, t),
|
||||
}
|
||||
err := addr.FromString(test.input)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, test.wantTLS, addr.TLSEnabled(), test.input)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue