[TASK] publish statistics (e.g. websocket)
This commit is contained in:
parent
7de61d62fb
commit
9579f62815
|
@ -25,14 +25,18 @@ type Node struct {
|
||||||
Wireless data.Wireless `json:"wireless"`
|
Wireless data.Wireless `json:"wireless"`
|
||||||
Owner string `json:"owner"`
|
Owner string `json:"owner"`
|
||||||
Address net.IP `json:"address"`
|
Address net.IP `json:"address"`
|
||||||
|
Stats struct {
|
||||||
|
Wireless data.WirelessStatistics `json:"wireless"`
|
||||||
|
Clients data.Clients `json:"clients"`
|
||||||
|
} `json:"statistics"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewNode(node *yanicRuntime.Node) *Node {
|
func NewNode(nodeOrigin *yanicRuntime.Node) *Node {
|
||||||
if nodeinfo := node.Nodeinfo; nodeinfo != nil {
|
if nodeinfo := nodeOrigin.Nodeinfo; nodeinfo != nil {
|
||||||
node := &Node{
|
node := &Node{
|
||||||
Hostname: nodeinfo.Hostname,
|
Hostname: nodeinfo.Hostname,
|
||||||
NodeID: nodeinfo.NodeID,
|
NodeID: nodeinfo.NodeID,
|
||||||
Address: node.Address,
|
Address: nodeOrigin.Address,
|
||||||
}
|
}
|
||||||
if owner := nodeinfo.Owner; owner != nil {
|
if owner := nodeinfo.Owner; owner != nil {
|
||||||
node.Owner = owner.Contact
|
node.Owner = owner.Contact
|
||||||
|
@ -43,6 +47,10 @@ func NewNode(node *yanicRuntime.Node) *Node {
|
||||||
if wireless := nodeinfo.Wireless; wireless != nil {
|
if wireless := nodeinfo.Wireless; wireless != nil {
|
||||||
node.Wireless = *wireless
|
node.Wireless = *wireless
|
||||||
}
|
}
|
||||||
|
if stats := nodeOrigin.Statistics; stats != nil {
|
||||||
|
node.Stats.Clients = stats.Clients
|
||||||
|
node.Stats.Wireless = stats.Wireless
|
||||||
|
}
|
||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue