diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-10-19 18:59:02 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-11-21 21:09:28 +0800 |
commit | 8c78449a9ef8f2a77cc1ff94f9a0a3178af21408 (patch) | |
tree | 61902b11284d1455ca7c109a512b93048d53ad4f /cmd/puppeth/module_ethstats.go | |
parent | 005665867d50a4b38e269b6b84156db2f75469a3 (diff) | |
download | go-tangerine-8c78449a9ef8f2a77cc1ff94f9a0a3178af21408.tar go-tangerine-8c78449a9ef8f2a77cc1ff94f9a0a3178af21408.tar.gz go-tangerine-8c78449a9ef8f2a77cc1ff94f9a0a3178af21408.tar.bz2 go-tangerine-8c78449a9ef8f2a77cc1ff94f9a0a3178af21408.tar.lz go-tangerine-8c78449a9ef8f2a77cc1ff94f9a0a3178af21408.tar.xz go-tangerine-8c78449a9ef8f2a77cc1ff94f9a0a3178af21408.tar.zst go-tangerine-8c78449a9ef8f2a77cc1ff94f9a0a3178af21408.zip |
cmd/puppeth: reorganize stats reports to make it readable
Diffstat (limited to 'cmd/puppeth/module_ethstats.go')
-rw-r--r-- | cmd/puppeth/module_ethstats.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/cmd/puppeth/module_ethstats.go b/cmd/puppeth/module_ethstats.go index 6ce662f65..2e83e366e 100644 --- a/cmd/puppeth/module_ethstats.go +++ b/cmd/puppeth/module_ethstats.go @@ -21,6 +21,7 @@ import ( "fmt" "math/rand" "path/filepath" + "strconv" "strings" "text/template" @@ -123,9 +124,15 @@ type ethstatsInfos struct { banned []string } -// String implements the stringer interface. -func (info *ethstatsInfos) String() string { - return fmt.Sprintf("host=%s, port=%d, secret=%s, banned=%v", info.host, info.port, info.secret, info.banned) +// Report converts the typed struct into a plain string->string map, cotnaining +// most - but not all - fields for reporting to the user. +func (info *ethstatsInfos) Report() map[string]string { + return map[string]string{ + "Website address": info.host, + "Website listener port": strconv.Itoa(info.port), + "Login secret": info.secret, + "Banned addresses": fmt.Sprintf("%v", info.banned), + } } // checkEthstats does a health-check against an ethstats server to verify whether |