refactored clients

This commit is contained in:
0xdcarns
2022-02-16 22:27:20 -05:00
parent 4d45523363
commit bd8b66c169
3 changed files with 12 additions and 15 deletions

View File

@@ -199,6 +199,12 @@ func NodeUpdate(client mqtt.Client, msg mqtt.Message) {
return
}
if ifaceDelta { // if a change caused an ifacedelta we need to notify the server to update the peers
pubErr := publishClientPeers(&cfg)
if pubErr != nil {
ncutils.Log("could not notify server to update peers after interface change")
} else {
ncutils.Log("signalled peer update to server")
}
ncutils.Log("applying WG conf to " + file)
err = wireguard.ApplyConf(&cfg.Node, cfg.Node.Interface, file)
if err != nil {
@@ -215,12 +221,6 @@ func NodeUpdate(client mqtt.Client, msg mqtt.Message) {
}
}
}
pubErr := publishClientPeers(&cfg)
if pubErr != nil {
ncutils.Log("could not notify server to update peers after interface change")
} else {
ncutils.Log("signalled peer update to server")
}
}
//deal with DNS
if newNode.DNSOn != "yes" && shouldDNSChange && cfg.Node.Interface != "" {