yanic/respond/daemon/neighbours.go

24 lines
464 B
Go
Raw Normal View History

2019-04-10 13:18:05 +02:00
package respondd
import (
"github.com/FreifunkBremen/yanic/data"
)
2019-04-10 21:57:31 +02:00
func (d *Daemon) updateNeighbours(iface string, resp *data.ResponseData) {
2019-04-10 13:18:05 +02:00
_, nodeID := d.getAnswer(iface)
2019-04-10 21:57:31 +02:00
resp.Neighbours.NodeID = nodeID
resp.Neighbours.Batadv = make(map[string]data.BatadvNeighbours)
2019-04-10 21:57:31 +02:00
for _, bface := range d.Batman {
2019-04-10 21:57:31 +02:00
b := NewBatman(bface)
if b == nil {
continue
}
2019-04-10 21:57:31 +02:00
for bfaceAddr, n := range b.Neighbours() {
resp.Neighbours.Batadv[bfaceAddr] = n
}
}
2019-04-10 13:18:05 +02:00
}