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

@ -322,6 +322,7 @@ func run(args yggArgs, ctx context.Context, done chan struct{}) {
if n.admin, err = admin.New(n.core, logger, options...); err != nil {
panic(err)
}
n.admin.SetupAdminHandlers()
}
// Setup the multicast module.

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()