Add getMulticastInterfaces and getSelf to yggdrasilctl

This commit is contained in:
Neil Alexander 2018-05-23 22:13:52 +01:00
parent 9b5965fd9a
commit 5d87601118
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 32 additions and 1 deletions

View file

@ -173,6 +173,13 @@ func (a *admin) init(c *Core, listenaddr string) {
}, nil
}
})
a.addHandler("getMulticastInterfaces", []string{}, func(in admin_info) (admin_info, error) {
var intfs []string
for _, v := range a.core.multicast.interfaces {
intfs = append(intfs, v.Name)
}
return admin_info{"multicast_interfaces": intfs}, nil
})
a.addHandler("getAllowedEncryptionPublicKeys", []string{}, func(in admin_info) (admin_info, error) {
return admin_info{"allowed_box_pubs": a.getAllowedEncryptionPublicKeys()}, nil
})
@ -414,10 +421,13 @@ func (a *admin) startTunWithMTU(ifname string, iftapmode bool, ifmtu int) error
func (a *admin) getData_getSelf() *admin_nodeInfo {
table := a.core.switchTable.table.Load().(lookupTable)
addr := a.core.router.addr
addr := (*a.core.GetAddress())[:]
subnet := (*a.core.GetSubnet())[:]
subnet = append(subnet, 0, 0, 0, 0, 0, 0, 0, 0)
coords := table.self.getCoords()
self := admin_nodeInfo{
{"ip", net.IP(addr[:]).String()},
{"subnet", fmt.Sprintf("%s/64", net.IP(subnet[:]).String())},
{"coords", fmt.Sprint(coords)},
}
return &self