9 "github.com/dustin/go-humanize"
10 vors "go.stargrave.org/vors/v3/internal"
14 Rooms = map[string]*Room{}
25 func (room *Room) Stats(now time.Time) []string {
26 sids := make([]int, 0, len(room.peers))
27 for sid := range room.peers {
28 sids = append(sids, int(sid))
31 lines := make([]string, 0, len(sids))
32 for _, sid := range sids {
33 peer := room.peers[byte(sid)]
38 "%12s | %s | Rx/Tx/Bad: %s / %s / %s | %s / %s",
41 humanize.Comma(peer.stats.pktsRx),
42 humanize.Comma(peer.stats.pktsTx),
43 humanize.Comma(peer.stats.bads),
44 humanize.IBytes(peer.stats.bytesRx),
45 humanize.IBytes(peer.stats.bytesTx),
48 line += " | " + vors.CRed + "MUTE" + vors.CReset
50 if peer.stats.last.Add(vors.ScreenRefresh).After(now) {
51 line += " | " + vors.CGreen + "TALK" + vors.CReset
53 lines = append(lines, line)