Remove Gateway field
This commit is contained in:
parent
8b8b1441ba
commit
0df8f5d615
|
@ -33,7 +33,7 @@ func BuildNodesV1(nodes *runtime.Nodes) interface{} {
|
||||||
Lastseen: nodeOrigin.Lastseen,
|
Lastseen: nodeOrigin.Lastseen,
|
||||||
Flags: Flags{
|
Flags: Flags{
|
||||||
Online: nodeOrigin.Online,
|
Online: nodeOrigin.Online,
|
||||||
Gateway: nodeOrigin.Gateway,
|
Gateway: nodeOrigin.IsGateway(),
|
||||||
},
|
},
|
||||||
Nodeinfo: nodeOrigin.Nodeinfo,
|
Nodeinfo: nodeOrigin.Nodeinfo,
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ func BuildNodesV2(nodes *runtime.Nodes) interface{} {
|
||||||
Lastseen: nodeOrigin.Lastseen,
|
Lastseen: nodeOrigin.Lastseen,
|
||||||
Flags: Flags{
|
Flags: Flags{
|
||||||
Online: nodeOrigin.Online,
|
Online: nodeOrigin.Online,
|
||||||
Gateway: nodeOrigin.Gateway,
|
Gateway: nodeOrigin.IsGateway(),
|
||||||
},
|
},
|
||||||
Nodeinfo: nodeOrigin.Nodeinfo,
|
Nodeinfo: nodeOrigin.Nodeinfo,
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,15 @@ type Node struct {
|
||||||
Firstseen jsontime.Time `json:"firstseen"`
|
Firstseen jsontime.Time `json:"firstseen"`
|
||||||
Lastseen jsontime.Time `json:"lastseen"`
|
Lastseen jsontime.Time `json:"lastseen"`
|
||||||
Online bool `json:"online"`
|
Online bool `json:"online"`
|
||||||
Gateway bool `json:"gateway"`
|
|
||||||
Statistics *data.Statistics `json:"statistics"`
|
Statistics *data.Statistics `json:"statistics"`
|
||||||
Nodeinfo *data.NodeInfo `json:"nodeinfo"`
|
Nodeinfo *data.NodeInfo `json:"nodeinfo"`
|
||||||
Neighbours *data.Neighbours `json:"-"`
|
Neighbours *data.Neighbours `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsGateway returns whether the node is a gateway
|
||||||
|
func (node *Node) IsGateway() bool {
|
||||||
|
if info := node.Nodeinfo; info != nil {
|
||||||
|
return info.VPN
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
|
@ -63,7 +63,6 @@ func (nodes *Nodes) Update(nodeID string, res *data.ResponseData) *Node {
|
||||||
// Update nodeinfo
|
// Update nodeinfo
|
||||||
if val := res.NodeInfo; val != nil {
|
if val := res.NodeInfo; val != nil {
|
||||||
node.Nodeinfo = val
|
node.Nodeinfo = val
|
||||||
node.Gateway = val.VPN
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update statistics
|
// Update statistics
|
||||||
|
|
|
@ -33,7 +33,7 @@ func NewGlobalStats(nodes *Nodes) (result *GlobalStats) {
|
||||||
result.ClientsWifi5 += stats.Clients.Wifi5
|
result.ClientsWifi5 += stats.Clients.Wifi5
|
||||||
result.ClientsWifi += stats.Clients.Wifi
|
result.ClientsWifi += stats.Clients.Wifi
|
||||||
}
|
}
|
||||||
if node.Gateway {
|
if node.IsGateway() {
|
||||||
result.Gateways++
|
result.Gateways++
|
||||||
}
|
}
|
||||||
if info := node.Nodeinfo; info != nil {
|
if info := node.Nodeinfo; info != nil {
|
||||||
|
|
Loading…
Reference in New Issue