Stop using wireguard in cluster.go

The wireguard is mostly used to compute metadata.
Metadata is now computed by main.go and encoded in
node.go, the cluster only receives a function generating
the binary metadata.
This commit is contained in:
kaiyou
2020-05-06 19:14:33 +02:00
committed by Leo Antunes
parent 0d93439d0d
commit 97525f4b10
3 changed files with 24 additions and 12 deletions

View File

@ -26,12 +26,9 @@ func (n *node) String() string {
return n.Addr.String()
}
func (c *cluster) NodeMeta(limit int) []byte {
func encodeNodeMeta(nm nodeMeta, limit int) []byte {
buf := &bytes.Buffer{}
if err := gob.NewEncoder(buf).Encode(nodeMeta{
OverlayAddr: c.wg.OverlayAddr,
PubKey: c.wg.PubKey.String(),
}); err != nil {
if err := gob.NewEncoder(buf).Encode(nm); err != nil {
logrus.Errorf("could not encode local state: %s", err)
return nil
}