From 3e0eccb54861407693adf4abe31080d592a39a51 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 26 May 2021 19:30:04 +0300 Subject: [PATCH] [#549] cli: Add TLS support to control service Signed-off-by: Pavel Karpy --- cmd/neofs-cli/modules/root.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cmd/neofs-cli/modules/root.go b/cmd/neofs-cli/modules/root.go index a98efec90..08be163c3 100644 --- a/cmd/neofs-cli/modules/root.go +++ b/cmd/neofs-cli/modules/root.go @@ -3,6 +3,7 @@ package cmd import ( "crypto/ecdsa" "crypto/rand" + "crypto/tls" "encoding/hex" "errors" "fmt" @@ -240,7 +241,17 @@ func getSDKClient(key *ecdsa.PrivateKey) (client.Client, error) { return nil, errInvalidEndpoint } - c, err := client.New(client.WithAddress(hostAddr), client.WithDefaultPrivateKey(key)) + options := []client.Option{ + client.WithAddress(hostAddr), + client.WithDefaultPrivateKey(key), + } + + if netAddr.TLSEnabled() { + options = append(options, client.WithTLSConfig(&tls.Config{})) + } + + c, err := client.New(options...) + return c, err }