1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-18 01:57:02 +00:00

Add some metric history

The count of connections and count of delivered messages now have 50
minutes of history available in the /about sparklines.
This commit is contained in:
James Hillyerd
2012-10-23 19:48:59 -07:00
parent 3b956a5341
commit bf0d6a6be5
4 changed files with 84 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
package smtpd
import (
"container/list"
"crypto/sha1"
"fmt"
"io"
@@ -25,3 +26,15 @@ func HashMailboxName(mailbox string) string {
io.WriteString(h, mailbox)
return fmt.Sprintf("%x", h.Sum(nil))
}
// JoinStringList joins a List containing strings by commas
func JoinStringList(listOfStrings *list.List) string {
if listOfStrings.Len() == 0 {
return ""
}
s := make([]string, 0, listOfStrings.Len())
for e := listOfStrings.Front(); e != nil; e = e.Next() {
s = append(s, e.Value.(string))
}
return strings.Join(s, ",")
}