Christopher Blaha 3 years ago
parent
commit
1bfdcbecb7
1 changed files with 7 additions and 7 deletions
  1. 7 7
      netclient/functions/daemon.go

+ 7 - 7
netclient/functions/daemon.go

@@ -167,9 +167,9 @@ func unsubscribeNode(client mqtt.Client, nodeCfg *config.ClientConfig) {
 	}
 	}
 	if token := client.Unsubscribe(fmt.Sprintf("peers/%s/%s", nodeCfg.Node.Network, nodeCfg.Node.ID)); token.WaitTimeout(mq.MQ_TIMEOUT*time.Second) && token.Error() != nil {
 	if token := client.Unsubscribe(fmt.Sprintf("peers/%s/%s", nodeCfg.Node.Network, nodeCfg.Node.ID)); token.WaitTimeout(mq.MQ_TIMEOUT*time.Second) && token.Error() != nil {
 		if token.Error() == nil {
 		if token.Error() == nil {
-			logger.Log(1, "network:", nodeCfg.Node.Network, "unable to unsubscribe from peer updates for node ", nodeCfg.Node.Name, "\n", "connection timeout")
+			logger.Log(1, "network:", nodeCfg.Node.Network, "unable to unsubscribe from peer updates for node", nodeCfg.Node.Name, "\n", "connection timeout")
 		} else {
 		} else {
-			logger.Log(1, "network:", nodeCfg.Node.Network, "unable to unsubscribe from peer updates for node ", nodeCfg.Node.Name, "\n", token.Error().Error())
+			logger.Log(1, "network:", nodeCfg.Node.Network, "unable to unsubscribe from peer updates for node", nodeCfg.Node.Name, "\n", token.Error().Error())
 		}
 		}
 		ok = false
 		ok = false
 	}
 	}
@@ -182,7 +182,7 @@ func unsubscribeNode(client mqtt.Client, nodeCfg *config.ClientConfig) {
 // the client should subscribe to ALL nodes that exist on server locally
 // the client should subscribe to ALL nodes that exist on server locally
 func messageQueue(ctx context.Context, wg *sync.WaitGroup, cfg *config.ClientConfig) {
 func messageQueue(ctx context.Context, wg *sync.WaitGroup, cfg *config.ClientConfig) {
 	defer wg.Done()
 	defer wg.Done()
-	logger.Log(0, "network:", cfg.Node.Network, "netclient message queue started for server: ", cfg.Server.Server)
+	logger.Log(0, "network:", cfg.Node.Network, "netclient message queue started for server:", cfg.Server.Server)
 	client, err := setupMQTT(cfg, false)
 	client, err := setupMQTT(cfg, false)
 	if err != nil {
 	if err != nil {
 		logger.Log(0, "unable to connect to broker", cfg.Server.Server, err.Error())
 		logger.Log(0, "unable to connect to broker", cfg.Server.Server, err.Error())
@@ -190,7 +190,7 @@ func messageQueue(ctx context.Context, wg *sync.WaitGroup, cfg *config.ClientCon
 	}
 	}
 	defer client.Disconnect(250)
 	defer client.Disconnect(250)
 	<-ctx.Done()
 	<-ctx.Done()
-	logger.Log(0, "shutting down message queue for server ", cfg.Server.Server)
+	logger.Log(0, "shutting down message queue for server", cfg.Server.Server)
 }
 }
 
 
 // NewTLSConf sets up tls configuration to connect to broker securely
 // NewTLSConf sets up tls configuration to connect to broker securely
@@ -199,7 +199,7 @@ func NewTLSConfig(server string) (*tls.Config, error) {
 	certpool := x509.NewCertPool()
 	certpool := x509.NewCertPool()
 	ca, err := os.ReadFile(file)
 	ca, err := os.ReadFile(file)
 	if err != nil {
 	if err != nil {
-		logger.Log(0, "could not read CA file ", err.Error())
+		logger.Log(0, "could not read CA file", err.Error())
 	}
 	}
 	ok := certpool.AppendCertsFromPEM(ca)
 	ok := certpool.AppendCertsFromPEM(ca)
 	if !ok {
 	if !ok {
@@ -207,7 +207,7 @@ func NewTLSConfig(server string) (*tls.Config, error) {
 	}
 	}
 	clientKeyPair, err := tls.LoadX509KeyPair(ncutils.GetNetclientServerPath(server)+ncutils.GetSeparator()+"client.pem", ncutils.GetNetclientPath()+ncutils.GetSeparator()+"client.key")
 	clientKeyPair, err := tls.LoadX509KeyPair(ncutils.GetNetclientServerPath(server)+ncutils.GetSeparator()+"client.pem", ncutils.GetNetclientPath()+ncutils.GetSeparator()+"client.key")
 	if err != nil {
 	if err != nil {
-		logger.Log(0, "could not read client cert/key ", err.Error())
+		logger.Log(0, "could not read client cert/key", err.Error())
 		return nil, err
 		return nil, err
 	}
 	}
 	certs := []tls.Certificate{clientKeyPair}
 	certs := []tls.Certificate{clientKeyPair}
@@ -246,7 +246,7 @@ func setupMQTT(cfg *config.ClientConfig, publish bool) (mqtt.Client, error) {
 		if !publish {
 		if !publish {
 			networks, err := ncutils.GetSystemNetworks()
 			networks, err := ncutils.GetSystemNetworks()
 			if err != nil {
 			if err != nil {
-				logger.Log(0, "error retriving networks ", err.Error())
+				logger.Log(0, "error retriving networks", err.Error())
 			}
 			}
 			for _, network := range networks {
 			for _, network := range networks {
 				var currNodeCfg config.ClientConfig
 				var currNodeCfg config.ClientConfig