[#549] cli: Add TLS support to control service
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
077f1af5a7
commit
3e0eccb548
1 changed files with 12 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue