Restore uptime, bytes_sent and bytes_recvd to getPeers (#888)

* Restore `uptime`, `bytes_sent` and `bytes_recvd` to the admin API for peers

* Wrap conn in Yggdrasil instead, so not necessary to do so in Ironwood

* Shuffle struct for alignment
This commit is contained in:
Neil Alexander 2022-02-01 13:37:45 +00:00 committed by GitHub
parent 9f5cc0eecb
commit 2d2ad4692b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 7 deletions

View file

@ -19,6 +19,9 @@ type PeerEntry struct {
Port uint64 `json:"port"`
Coords []uint64 `json:"coords"`
Remote string `json:"remote"`
RXBytes uint64 `json:"bytes_recvd"`
TXBytes uint64 `json:"bytes_sent"`
Uptime float64 `json:"uptime"`
}
func (a *AdminSocket) getPeersHandler(req *GetPeersRequest, res *GetPeersResponse) error {
@ -31,6 +34,9 @@ func (a *AdminSocket) getPeersHandler(req *GetPeersRequest, res *GetPeersRespons
Port: p.Port,
Coords: p.Coords,
Remote: p.Remote,
RXBytes: p.RXBytes,
TXBytes: p.TXBytes,
Uptime: p.Uptime.Seconds(),
}
}
return nil