mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-07 01:36:23 +08:00
additional checks for disconnected nodes
This commit is contained in:
@@ -61,6 +61,10 @@ func GetPeerUpdate(node *models.Node) (models.PeerUpdate, error) {
|
|||||||
if node.NetworkSettings.IsPointToSite == "yes" && node.IsHub == "no" && peer.IsHub == "no" {
|
if node.NetworkSettings.IsPointToSite == "yes" && node.IsHub == "no" && peer.IsHub == "no" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if node.Connected != "yes" {
|
||||||
|
//skip unconnected nodes
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// if the node is not a server, set the endpoint
|
// if the node is not a server, set the endpoint
|
||||||
var setEndpoint = !(node.IsServer == "yes")
|
var setEndpoint = !(node.IsServer == "yes")
|
||||||
|
@@ -94,12 +94,14 @@ func startGoRoutines(wg *sync.WaitGroup) context.CancelFunc {
|
|||||||
cfg := config.ClientConfig{}
|
cfg := config.ClientConfig{}
|
||||||
cfg.Network = network
|
cfg.Network = network
|
||||||
cfg.ReadConfig()
|
cfg.ReadConfig()
|
||||||
|
if cfg.Node.Connected == "yes" {
|
||||||
if err := wireguard.ApplyConf(&cfg.Node, cfg.Node.Interface, ncutils.GetNetclientPathSpecific()+cfg.Node.Interface+".conf"); err != nil {
|
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())
|
logger.Log(0, "failed to start ", cfg.Node.Interface, "wg interface", err.Error())
|
||||||
}
|
}
|
||||||
if cfg.PublicIPService != "" {
|
if cfg.PublicIPService != "" {
|
||||||
global_settings.PublicIPServices[network] = cfg.PublicIPService
|
global_settings.PublicIPServices[network] = cfg.PublicIPService
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
server := cfg.Server.Server
|
server := cfg.Server.Server
|
||||||
if !serverSet[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
|
// defaults to iptables for now, may need another default for non-Linux OSes
|
||||||
nodeCfg.Node.FirewallInUse = models.FIREWALL_IPTABLES
|
nodeCfg.Node.FirewallInUse = models.FIREWALL_IPTABLES
|
||||||
}
|
}
|
||||||
|
if nodeCfg.Node.Connected == "yes" {
|
||||||
if nodeCfg.Node.IsStatic != "yes" {
|
if nodeCfg.Node.IsStatic != "yes" {
|
||||||
extIP, err := ncutils.GetPublicIP(nodeCfg.Server.API)
|
extIP, err := ncutils.GetPublicIP(nodeCfg.Server.API)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -107,6 +108,7 @@ func checkin(currentRun int) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//check version
|
//check version
|
||||||
if nodeCfg.Node.Version != ncutils.Version {
|
if nodeCfg.Node.Version != ncutils.Version {
|
||||||
nodeCfg.Node.Version = ncutils.Version
|
nodeCfg.Node.Version = ncutils.Version
|
||||||
|
Reference in New Issue
Block a user