func FileExists(filePath string) bool {
	if _, err := os.Stat(filePath); os.IsNotExist(err) {
		return false
	}
	return true
}
FileExists checks if a file exists in the given path
package main
import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"os"
	"os/signal"
	"strconv"
	"github.com/amitbet/teleporter/agent"
	"github.com/amitbet/teleporter/logger"
)
func readConfig(file string) (*agent.AgentConfig, error) {
	clientConfigStr, err := ioutil.ReadFile(file)
	if err != nil {
		logger.Error("Client connect, failed while reading client header: %s\n", err)
		return nil, err
	}
	cconfig := agent.AgentConfig{}
	err = json.Unmarshal([]byte(clientConfigStr), &cconfig)
	if err != nil {
		logger.Error("Client connect, error unmarshaling clientConfig: %s\n", err)
		return nil, err
	}
	return &cconfig, nil
}
func writeConfig(file string, config *agent.AgentConfig) error {
	jstr, err := json.MarshalIndent(config, "", "    ")
	if err != nil {
		logger.Error("writeConfig: problem in netConfig json marshaling: ", err)
		return err
	}
	err = ioutil.WriteFile(file, jstr, 0644)
	if err != nil {
		logger.Error("writeConfig: Problem in sending network config: ", err)
		return err
	}
	return nil
}