mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
add uptime and bytes sent/recvd to peer struct and getPeers
This commit is contained in:
parent
fdb826578f
commit
5c0636eb3d
2 changed files with 21 additions and 8 deletions
|
@ -10,6 +10,7 @@ import "net/url"
|
|||
import "sort"
|
||||
import "strings"
|
||||
import "strconv"
|
||||
import "sync/atomic"
|
||||
import "time"
|
||||
|
||||
// TODO? Make all of this JSON
|
||||
|
@ -322,6 +323,9 @@ func (a *admin) getData_getPeers() []admin_nodeInfo {
|
|||
info := admin_nodeInfo{
|
||||
{"IP", net.IP(addr[:]).String()},
|
||||
{"port", fmt.Sprint(port)},
|
||||
{"uptime", fmt.Sprint(time.Since(p.firstSeen))},
|
||||
{"bytesSent", fmt.Sprint(atomic.LoadUint64(&p.bytesSent))},
|
||||
{"bytesRecvd", fmt.Sprint(atomic.LoadUint64(&p.bytesRecvd))},
|
||||
}
|
||||
peerInfos = append(peerInfos, info)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue