fixing windows join issue

This commit is contained in:
afeiszli
2022-03-15 11:11:22 -04:00
parent b73272bdee
commit fbb18d86d0
3 changed files with 5 additions and 1 deletions

View File

@@ -109,6 +109,9 @@ func NodeUpdate(client mqtt.Client, msg mqtt.Message) {
}
if ifaceDelta { // if a change caused an ifacedelta we need to notify the server to update the peers
ncutils.Log("applying WG conf to " + file)
if ncutils.IsWindows() {
wireguard.RemoveConfGraceful(nodeCfg.Node.Interface)
}
err = wireguard.ApplyConf(&nodeCfg.Node, nodeCfg.Node.Interface, file)
if err != nil {
ncutils.Log("error restarting wg after node update " + err.Error())

Binary file not shown.

View File

@@ -192,6 +192,7 @@ func InitWireguard(node *models.Node, privkey string, peers []wgtypes.PeerConfig
} else {
_, devErr := wgclient.Device(deviceiface)
if !ifaceReady || devErr != nil {
fmt.Printf("%v\n", devErr)
return fmt.Errorf("could not reliably create interface, please check wg installation and retry")
}
}
@@ -287,7 +288,6 @@ func ApplyConf(node *models.Node, ifacename string, confPath string) error {
var err error
switch os {
case "windows":
RemoveConfGraceful(ifacename)
ApplyWindowsConf(confPath)
case "darwin":
ApplyMacOSConf(node, ifacename, confPath)
@@ -490,4 +490,5 @@ func RemoveConfGraceful(ifacename string) {
break
}
}
time.Sleep(time.Second << 1)
}