Skip to content

Commit

Permalink
babel nodeinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
genofire committed May 18, 2019
1 parent 3b4e88c commit fd33fe0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions respond/daemon/nodeinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"runtime"
"strings"

babelParser "github.com/Vivena/babelweb2/parser"
"github.com/bdlm/log"

"github.com/FreifunkBremen/yanic/data"
Expand Down Expand Up @@ -84,6 +85,27 @@ func (d *Daemon) updateNodeinfo(iface string, resp *data.ResponseData) {

resp.Nodeinfo.Network.Mesh[bface] = &mesh
}

if d.babelData == nil {
return
}

meshBabel := data.NetworkInterface{}
resp.Nodeinfo.Network.Mesh["babel"] = &meshBabel

d.babelData.Iter(func(bu babelParser.BabelUpdate) error {
sbu := bu.ToSUpdate()
if sbu.TableId != "interface" {
return nil
}
if sbu.EntryData["up"].(bool) {
addr := sbu.EntryData["ipv6"].(string)

resp.Nodeinfo.Network.Addresses = append(resp.Nodeinfo.Network.Addresses, addr)
meshBabel.Interfaces.Tunnel = append(meshBabel.Interfaces.Tunnel, addr)
}
return nil
})
}

func getAddresses(iface string) (addrs []string) {
Expand Down

0 comments on commit fd33fe0

Please sign in to comment.