From 23411fc23dcf82e0ed35a780bfdda2341bedf819 Mon Sep 17 00:00:00 2001 From: Jeff Halter <868228+jhalter@users.noreply.github.com> Date: Wed, 8 Jun 2022 20:54:07 -0700 Subject: Add flag to enable optional stats HTTP endpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit re: #29 TODO: add more stat counters Usage: ``` ./mobius-hotline-server -stats-port 5503 ``` ``` ❯ curl -s localhost:5503 | jq . { "LoginCount": 0, "StartTime": "2022-06-08T20:49:10.183921-07:00", "DownloadCounter": 0, "UploadCounter": 0 } ``` --- hotline/stats.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'hotline/stats.go') diff --git a/hotline/stats.go b/hotline/stats.go index dd8ea1d..4b9119d 100644 --- a/hotline/stats.go +++ b/hotline/stats.go @@ -6,9 +6,10 @@ import ( ) type Stats struct { - LoginCount int `yaml:"login count"` - StartTime time.Time `yaml:"start time"` - Uptime time.Duration `yaml:"uptime"` + LoginCount int `yaml:"login count"` + StartTime time.Time `yaml:"start time"` + DownloadCounter int + UploadCounter int } func (s *Stats) String() string { -- cgit