mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-04 16:33:49 +08:00
token configs and secure grpc working
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package functions
|
||||
|
||||
import (
|
||||
"google.golang.org/grpc/credentials"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
@@ -287,6 +289,10 @@ func LeaveNetwork(network string) error {
|
||||
var wcclient nodepb.NodeServiceClient
|
||||
var requestOpts grpc.DialOption
|
||||
requestOpts = grpc.WithInsecure()
|
||||
if cfg.Server.GRPCSSL == "on" {
|
||||
h2creds := credentials.NewTLS(&tls.Config{NextProtos: []string{"h2"}})
|
||||
requestOpts = grpc.WithTransportCredentials(h2creds)
|
||||
}
|
||||
conn, err := grpc.Dial(servercfg.GRPCAddress, requestOpts)
|
||||
if err != nil {
|
||||
log.Printf("Unable to establish client connection to " + servercfg.GRPCAddress + ": %v", err)
|
||||
|
Reference in New Issue
Block a user