[#1446] services/tree: Use grpc.WithInsecure
only for nodes without TLS
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
ad3038d16d
commit
a2edfec0c3
1 changed files with 10 additions and 3 deletions
|
@ -2,6 +2,7 @@ package tree
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -59,10 +60,16 @@ func dialTreeService(ctx context.Context, netmapAddr string) (*grpc.ClientConn,
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts := make([]grpc.DialOption, 1, 2)
|
||||||
|
opts[0] = grpc.WithBlock()
|
||||||
|
|
||||||
|
// FIXME(@fyrchik): ugly hack #1322
|
||||||
|
if !strings.HasPrefix(netAddr.URIAddr(), "grpcs:") {
|
||||||
|
opts = append(opts, grpc.WithInsecure())
|
||||||
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(ctx, defaultClientConnectTimeout)
|
ctx, cancel := context.WithTimeout(ctx, defaultClientConnectTimeout)
|
||||||
cc, err := grpc.DialContext(ctx, netAddr.URIAddr(),
|
cc, err := grpc.DialContext(ctx, netAddr.URIAddr(), opts...)
|
||||||
grpc.WithInsecure(),
|
|
||||||
grpc.WithBlock())
|
|
||||||
cancel()
|
cancel()
|
||||||
|
|
||||||
return cc, err
|
return cc, err
|
||||||
|
|
Loading…
Reference in a new issue