replace ncutil.Log/PrintLog with logger.Log

This commit is contained in:
Matthew R. Kasun
2022-03-20 11:12:05 -04:00
committed by 0xdcarns
parent 28efa45419
commit 11b1098390
28 changed files with 274 additions and 245 deletions

View File

@@ -3,6 +3,7 @@ package wireguard
import (
"fmt"
"github.com/gravitl/netmaker/logger"
"github.com/gravitl/netmaker/netclient/ncutils"
)
@@ -14,7 +15,7 @@ func ApplyWindowsConf(confPath string) error {
copyConfPath := fmt.Sprintf("%s\\%s", ncutils.WINDOWS_WG_DPAPI_PATH, pathStrings[1])
err := ncutils.Copy(confPath, copyConfPath)
if err != nil {
ncutils.PrintLog(err.Error(), 1)
logger.Log(err.Error(), 1)
}
}
*/
@@ -28,7 +29,7 @@ func ApplyWindowsConf(confPath string) error {
// RemoveWindowsConf - removes the WireGuard configuration file on Windows and dpapi file
func RemoveWindowsConf(ifacename string, printlog bool) error {
if _, err := ncutils.RunCmd("wireguard.exe /uninstalltunnelservice "+ifacename, printlog); err != nil {
ncutils.PrintLog(err.Error(), 1)
logger.Log(1, err.Error())
}
/*
dpapipath := fmt.Sprintf("%s\\%s.conf.dpapi", ncutils.WINDOWS_WG_DPAPI_PATH, ifacename)
@@ -36,14 +37,14 @@ func RemoveWindowsConf(ifacename string, printlog bool) error {
if ncutils.FileExists(confpath) {
err := os.Remove(confpath)
if err != nil {
ncutils.PrintLog(err.Error(), 1)
logger.Log(err.Error(), 1)
}
}
time.Sleep(time.Second >> 2)
if ncutils.FileExists(dpapipath) {
err := os.Remove(dpapipath)
if err != nil {
ncutils.PrintLog(err.Error(), 1)
logger.Log(err.Error(), 1)
}
}
*/