mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-22 04:55:33 +08:00
sync always
This commit is contained in:
parent
3aaf83d04d
commit
c621f6c2d6
1 changed files with 12 additions and 12 deletions
|
@ -275,22 +275,22 @@ func UpdatePeers(client mqtt.Client, msg mqtt.Message) {
|
|||
insert(peerUpdate.Network, lastPeerUpdate, string(data))
|
||||
ncutils.Log("update peer handler")
|
||||
|
||||
file := ncutils.GetNetclientPathSpecific() + cfg.Node.Interface + ".conf"
|
||||
var shouldReSub = shouldResub(cfg.Node.NetworkSettings.DefaultServerAddrs, peerUpdate.ServerAddrs)
|
||||
if shouldReSub {
|
||||
Resubscribe(client, &cfg)
|
||||
cfg.Node.NetworkSettings.DefaultServerAddrs = peerUpdate.ServerAddrs
|
||||
file := ncutils.GetNetclientPathSpecific() + cfg.Node.Interface + ".conf"
|
||||
err = wireguard.UpdateWgPeers(file, peerUpdate.Peers)
|
||||
if err != nil {
|
||||
ncutils.Log("error updating wireguard peers" + err.Error())
|
||||
return
|
||||
}
|
||||
ncutils.Log("syncing conf to " + file)
|
||||
err = wireguard.SyncWGQuickConf(cfg.Node.Interface, file)
|
||||
if err != nil {
|
||||
ncutils.Log("error syncing wg after peer update " + err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
err = wireguard.UpdateWgPeers(file, peerUpdate.Peers)
|
||||
if err != nil {
|
||||
ncutils.Log("error updating wireguard peers" + err.Error())
|
||||
return
|
||||
}
|
||||
ncutils.Log("syncing conf to " + file)
|
||||
err = wireguard.SyncWGQuickConf(cfg.Node.Interface, file)
|
||||
if err != nil {
|
||||
ncutils.Log("error syncing wg after peer update " + err.Error())
|
||||
return
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue