package main import ( "flag" "fmt" "net/http" "os" xprometheus "xinu.tv/imapstore/prometheus" "github.com/golang/glog" "github.com/jordwest/imap-server" "github.com/jordwest/imap-server/mailstore" "github.com/prometheus/client_golang/prometheus" ) var ( imapAddr = flag.String("imap", ":10143", "listen address for IMAP") httpAddr = flag.String("http", ":10080", "listen address for HTTP") ) func main() { flag.Parse() defer glog.Flush() http.Handle("/metrics", prometheus.Handler()) go func() { glog.Fatal(http.ListenAndServe(*httpAddr, nil)) }() var store mailstore.Mailstore store = mailstore.NewDummyMailstore() store = xprometheus.NewMailstore(store) s := imap.NewServer(store) s.Transcript = os.Stdout s.Addr = *imapAddr if err := s.ListenAndServe(); err != nil { fmt.Printf("Error creating test connection: %s\n", err) } }