diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-07-30 21:15:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-30 21:15:35 +0800 |
commit | 6380c06c6541f6a3422ea3c173baa00100e4ba8e (patch) | |
tree | 7330a1fa0e739df39a71557acd7202e136193f04 | |
parent | 2cffd4ff3c6643e374e34bccd8d68cb52d7d4c8b (diff) | |
parent | f00d0daf33e764d3c344c2f06281b5d50d0d1590 (diff) | |
download | dexon-6380c06c6541f6a3422ea3c173baa00100e4ba8e.tar dexon-6380c06c6541f6a3422ea3c173baa00100e4ba8e.tar.gz dexon-6380c06c6541f6a3422ea3c173baa00100e4ba8e.tar.bz2 dexon-6380c06c6541f6a3422ea3c173baa00100e4ba8e.tar.lz dexon-6380c06c6541f6a3422ea3c173baa00100e4ba8e.tar.xz dexon-6380c06c6541f6a3422ea3c173baa00100e4ba8e.tar.zst dexon-6380c06c6541f6a3422ea3c173baa00100e4ba8e.zip |
Merge pull request #17279 from karalabe/puppeth-banlist-fix
cmd/puppeth: split banned ethstats addresses over columns
-rw-r--r-- | cmd/puppeth/module_ethstats.go | 2 | ||||
-rw-r--r-- | cmd/puppeth/wizard_netstats.go | 26 |
2 files changed, 17 insertions, 11 deletions
diff --git a/cmd/puppeth/module_ethstats.go b/cmd/puppeth/module_ethstats.go index 20b7afe23..1a7b48426 100644 --- a/cmd/puppeth/module_ethstats.go +++ b/cmd/puppeth/module_ethstats.go @@ -122,7 +122,7 @@ func (info *ethstatsInfos) Report() 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), + "Banned addresses": strings.Join(info.banned, "\n"), } } diff --git a/cmd/puppeth/wizard_netstats.go b/cmd/puppeth/wizard_netstats.go index a307c5ee3..89b38e262 100644 --- a/cmd/puppeth/wizard_netstats.go +++ b/cmd/puppeth/wizard_netstats.go @@ -203,7 +203,7 @@ func (stats serverStats) render() { table.SetHeader([]string{"Server", "Address", "Service", "Config", "Value"}) table.SetAlignment(tablewriter.ALIGN_LEFT) - table.SetColWidth(100) + table.SetColWidth(40) // Find the longest lines for all columns for the hacked separator separator := make([]string, 5) @@ -222,8 +222,10 @@ func (stats serverStats) render() { if len(config) > len(separator[3]) { separator[3] = strings.Repeat("-", len(config)) } - if len(value) > len(separator[4]) { - separator[4] = strings.Repeat("-", len(value)) + for _, val := range strings.Split(value, "\n") { + if len(val) > len(separator[4]) { + separator[4] = strings.Repeat("-", len(val)) + } } } } @@ -263,13 +265,17 @@ func (stats serverStats) render() { sort.Strings(configs) for k, config := range configs { - switch { - case j == 0 && k == 0: - table.Append([]string{server, stats[server].address, service, config, stats[server].services[service][config]}) - case k == 0: - table.Append([]string{"", "", service, config, stats[server].services[service][config]}) - default: - table.Append([]string{"", "", "", config, stats[server].services[service][config]}) + for l, value := range strings.Split(stats[server].services[service][config], "\n") { + switch { + case j == 0 && k == 0 && l == 0: + table.Append([]string{server, stats[server].address, service, config, value}) + case k == 0 && l == 0: + table.Append([]string{"", "", service, config, value}) + case l == 0: + table.Append([]string{"", "", "", config, value}) + default: + table.Append([]string{"", "", "", "", value}) + } } } } |