mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-26 05:56:36 +08:00
Merge pull request #1597 from gravitl/bugfix_v0.16.1_disconnect_cleanup
additional checks for disconnected nodes
This commit is contained in:
commit
318914c48b
3 changed files with 45 additions and 37 deletions
|
|
@ -61,6 +61,10 @@ func GetPeerUpdate(node *models.Node) (models.PeerUpdate, error) {
|
|||
if node.NetworkSettings.IsPointToSite == "yes" && node.IsHub == "no" && peer.IsHub == "no" {
|
||||
continue
|
||||
}
|
||||
if node.Connected != "yes" {
|
||||
//skip unconnected nodes
|
||||
continue
|
||||
}
|
||||
|
||||
// if the node is not a server, set the endpoint
|
||||
var setEndpoint = !(node.IsServer == "yes")
|
||||
|
|
|
|||
|
|
@ -94,12 +94,14 @@ func startGoRoutines(wg *sync.WaitGroup) context.CancelFunc {
|
|||
cfg := config.ClientConfig{}
|
||||
cfg.Network = network
|
||||
cfg.ReadConfig()
|
||||
if cfg.Node.Connected == "yes" {
|
||||
if err := wireguard.ApplyConf(&cfg.Node, cfg.Node.Interface, ncutils.GetNetclientPathSpecific()+cfg.Node.Interface+".conf"); err != nil {
|
||||
logger.Log(0, "failed to start ", cfg.Node.Interface, "wg interface", err.Error())
|
||||
}
|
||||
if cfg.PublicIPService != "" {
|
||||
global_settings.PublicIPServices[network] = cfg.PublicIPService
|
||||
}
|
||||
}
|
||||
|
||||
server := cfg.Server.Server
|
||||
if !serverSet[server] {
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ func checkin(currentRun int) {
|
|||
// defaults to iptables for now, may need another default for non-Linux OSes
|
||||
nodeCfg.Node.FirewallInUse = models.FIREWALL_IPTABLES
|
||||
}
|
||||
if nodeCfg.Node.Connected == "yes" {
|
||||
if nodeCfg.Node.IsStatic != "yes" {
|
||||
extIP, err := ncutils.GetPublicIP(nodeCfg.Server.API)
|
||||
if err != nil {
|
||||
|
|
@ -107,6 +108,7 @@ func checkin(currentRun int) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//check version
|
||||
if nodeCfg.Node.Version != ncutils.Version {
|
||||
nodeCfg.Node.Version = ncutils.Version
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue