mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-05 08:47:35 +08:00
moved checks around
This commit is contained in:
@@ -105,6 +105,12 @@ func NodeUpdate(client mqtt.Client, msg mqtt.Message) {
|
||||
}
|
||||
file := ncutils.GetNetclientPathSpecific() + nodeCfg.Node.Interface + ".conf"
|
||||
|
||||
if ifaceDelta { // if a change caused an ifacedelta we need to notify the server to update the peers
|
||||
err = ncutils.ModPort(&newNode)
|
||||
if err != nil {
|
||||
logger.Log(0, "error modifying node port on", newNode.Name, "-", err.Error())
|
||||
return
|
||||
}
|
||||
if err := wireguard.UpdateWgInterface(file, privateKey, nameserver, newNode); err != nil {
|
||||
logger.Log(0, "error updating wireguard config "+err.Error())
|
||||
return
|
||||
@@ -112,12 +118,6 @@ func NodeUpdate(client mqtt.Client, msg mqtt.Message) {
|
||||
if keepaliveChange {
|
||||
wireguard.UpdateKeepAlive(file, newNode.PersistentKeepalive)
|
||||
}
|
||||
if ifaceDelta { // if a change caused an ifacedelta we need to notify the server to update the peers
|
||||
err = ncutils.ModPort(&nodeCfg.Node)
|
||||
if err != nil {
|
||||
logger.Log(0, "error modifying node port on", nodeCfg.Node.Name, "-", err.Error())
|
||||
return
|
||||
}
|
||||
logger.Log(0, "applying WG conf to "+file)
|
||||
if ncutils.IsWindows() {
|
||||
wireguard.RemoveConfGraceful(nodeCfg.Node.Interface)
|
||||
|
@@ -63,11 +63,13 @@ func Pull(network string, iface bool) (*models.Node, error) {
|
||||
logger.Log(0, "unable to update server config: "+err.Error())
|
||||
}
|
||||
}
|
||||
if nodeGET.Node.ListenPort != cfg.Node.ListenPort {
|
||||
err = ncutils.ModPort(&resNode)
|
||||
logger.Log(0, "port is now", strconv.Itoa(int(resNode.ListenPort)))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
logger.Log(0, "port is now", strconv.Itoa(int(resNode.ListenPort)))
|
||||
}
|
||||
if err = config.ModNodeConfig(&resNode); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user