mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2025-06-15 07:26:05 +00:00
Extend getSessions
admin call to include uptime/TX/RX
This commit is contained in:
@ -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.
|
||||
|
@ -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()
|
||||
|
Reference in New Issue
Block a user