Use localNode to store the local node name

Also rename setupDelegate to SetLocalNode, so that
main can call SetLocalNode then Update().
This commit is contained in:
kaiyou
2020-05-10 17:37:06 +02:00
committed by Leo Antunes
parent 28a31efc1f
commit 078946dbdd
2 changed files with 26 additions and 21 deletions

View File

@ -50,11 +50,12 @@ func main() {
}
// Assign a local node address and propagate it to the cluster
wgstate.AssignOverlayAddr((*net.IPNet)(config.OverlayNet), cluster.LocalName)
localNode := common.Node{}
wgstate.AssignOverlayAddr((*net.IPNet)(config.OverlayNet), cluster.Name())
localNode := &common.Node{}
localNode.OverlayAddr = wgstate.OverlayAddr
localNode.PubKey = wgstate.PubKey.String()
cluster.Update(localNode)
cluster.SetLocalNode(localNode)
cluster.Update()
// Join the cluster
nodec := cluster.Members() // avoid deadlocks by starting before join