mirror of
https://github.com/gravitl/netmaker.git
synced 2025-11-06 23:05:57 +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))
|
insert(peerUpdate.Network, lastPeerUpdate, string(data))
|
||||||
ncutils.Log("update peer handler")
|
ncutils.Log("update peer handler")
|
||||||
|
|
||||||
|
file := ncutils.GetNetclientPathSpecific() + cfg.Node.Interface + ".conf"
|
||||||
var shouldReSub = shouldResub(cfg.Node.NetworkSettings.DefaultServerAddrs, peerUpdate.ServerAddrs)
|
var shouldReSub = shouldResub(cfg.Node.NetworkSettings.DefaultServerAddrs, peerUpdate.ServerAddrs)
|
||||||
if shouldReSub {
|
if shouldReSub {
|
||||||
Resubscribe(client, &cfg)
|
Resubscribe(client, &cfg)
|
||||||
cfg.Node.NetworkSettings.DefaultServerAddrs = peerUpdate.ServerAddrs
|
cfg.Node.NetworkSettings.DefaultServerAddrs = peerUpdate.ServerAddrs
|
||||||
file := ncutils.GetNetclientPathSpecific() + cfg.Node.Interface + ".conf"
|
}
|
||||||
err = wireguard.UpdateWgPeers(file, peerUpdate.Peers)
|
err = wireguard.UpdateWgPeers(file, peerUpdate.Peers)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ncutils.Log("error updating wireguard peers" + err.Error())
|
ncutils.Log("error updating wireguard peers" + err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ncutils.Log("syncing conf to " + file)
|
ncutils.Log("syncing conf to " + file)
|
||||||
err = wireguard.SyncWGQuickConf(cfg.Node.Interface, file)
|
err = wireguard.SyncWGQuickConf(cfg.Node.Interface, file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ncutils.Log("error syncing wg after peer update " + err.Error())
|
ncutils.Log("error syncing wg after peer update " + err.Error())
|
||||||
return
|
return
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue