edited windows to new daemon

This commit is contained in:
0xdcarns
2022-02-02 00:18:02 -05:00
parent 03a30b6bbc
commit f279245f9e
4 changed files with 28 additions and 22 deletions

View File

@@ -53,17 +53,20 @@ func SetWGKeyConfig(network string, serveraddr string) error {
// ApplyWGQuickConf - applies wg-quick commands if os supports
func ApplyWGQuickConf(confPath string, ifacename string) error {
_, err := os.Stat(confPath)
if err != nil {
ncutils.Log(confPath + " does not exist " + err.Error())
if ncutils.IsWindows() {
return ApplyWindowsConf(confPath)
} else {
_, err := os.Stat(confPath)
if err != nil {
ncutils.Log(confPath + " does not exist " + err.Error())
return err
}
if ncutils.IfaceExists(ifacename) {
ncutils.RunCmd("wg-quick down "+confPath, true)
}
_, err = ncutils.RunCmd("wg-quick up "+confPath, true)
return err
}
if ncutils.IfaceExists(ifacename) {
ncutils.RunCmd("wg-quick down "+confPath, true)
}
_, err = ncutils.RunCmd("wg-quick up "+confPath, true)
return err
}
// ApplyMacOSConf - applies system commands similar to wg-quick using golang for MacOS