Extend getSessions admin call to include uptime/TX/RX

This commit is contained in:
Neil Alexander 2022-09-03 16:55:57 +01:00
parent 5477566fa9
commit dc9720e580
6 changed files with 23 additions and 97 deletions

View file

@ -216,11 +216,14 @@ func run() int {
if err := json.Unmarshal(recv.Response, &resp); err != nil {
panic(err)
}
table.SetHeader([]string{"Public Key", "IP Address"})
table.SetHeader([]string{"Public Key", "IP Address", "Uptime", "RX", "TX"})
for _, p := range resp.Sessions {
table.Append([]string{
p.PublicKey,
p.IPAddress,
(time.Duration(p.Uptime) * time.Second).String(),
p.RXBytes.String(),
p.TXBytes.String(),
})
}
table.Render()