mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-10 23:24:32 +08:00
fetch networks for checkin
This commit is contained in:
parent
cdc7ec7495
commit
aa9be268f3
1 changed files with 48 additions and 45 deletions
|
@ -19,9 +19,6 @@ import (
|
|||
"github.com/gravitl/netmaker/tls"
|
||||
)
|
||||
|
||||
// pubNetworks hold the currently publishable networks
|
||||
var pubNetworks []string
|
||||
|
||||
// Checkin -- go routine that checks for public or local ip changes, publishes changes
|
||||
// if there are no updates, simply "pings" the server as a checkin
|
||||
func Checkin(ctx context.Context, wg *sync.WaitGroup) {
|
||||
|
@ -34,7 +31,15 @@ func Checkin(ctx context.Context, wg *sync.WaitGroup) {
|
|||
return
|
||||
//delay should be configuraable -> use cfg.Node.NetworkSettings.DefaultCheckInInterval ??
|
||||
case <-time.After(time.Second * 60):
|
||||
for _, network := range pubNetworks {
|
||||
checkin()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func checkin() {
|
||||
networks, _ := ncutils.GetSystemNetworks()
|
||||
logger.Log(3, "checkin with server(s) for all networks")
|
||||
for _, network := range networks {
|
||||
var nodeCfg config.ClientConfig
|
||||
nodeCfg.Network = network
|
||||
nodeCfg.ReadConfig()
|
||||
|
@ -79,8 +84,6 @@ func Checkin(ctx context.Context, wg *sync.WaitGroup) {
|
|||
Hello(&nodeCfg)
|
||||
checkCertExpiry(&nodeCfg)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PublishNodeUpdates -- saves node and pushes changes to broker
|
||||
|
|
Loading…
Add table
Reference in a new issue