aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/puppeth/wizard_ethstats.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-10-27 19:36:49 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-11-21 21:09:39 +0800
commitffc12f63ec57682e7c7f6653332856acbeef3183 (patch)
tree581a82231e18824c36f759421f78caa2cd83a8de /cmd/puppeth/wizard_ethstats.go
parent80be5e546398203c1958a0f512e651a2c36b1fe0 (diff)
downloadgo-tangerine-ffc12f63ec57682e7c7f6653332856acbeef3183.tar
go-tangerine-ffc12f63ec57682e7c7f6653332856acbeef3183.tar.gz
go-tangerine-ffc12f63ec57682e7c7f6653332856acbeef3183.tar.bz2
go-tangerine-ffc12f63ec57682e7c7f6653332856acbeef3183.tar.lz
go-tangerine-ffc12f63ec57682e7c7f6653332856acbeef3183.tar.xz
go-tangerine-ffc12f63ec57682e7c7f6653332856acbeef3183.tar.zst
go-tangerine-ffc12f63ec57682e7c7f6653332856acbeef3183.zip
cmd/puppeth: simplifications and pre-built docker images
Diffstat (limited to 'cmd/puppeth/wizard_ethstats.go')
-rw-r--r--cmd/puppeth/wizard_ethstats.go71
1 files changed, 39 insertions, 32 deletions
diff --git a/cmd/puppeth/wizard_ethstats.go b/cmd/puppeth/wizard_ethstats.go
index 1bde5a3fd..56dbeb9b4 100644
--- a/cmd/puppeth/wizard_ethstats.go
+++ b/cmd/puppeth/wizard_ethstats.go
@@ -34,6 +34,8 @@ func (w *wizard) deployEthstats() {
client := w.servers[server]
// Retrieve any active ethstats configurations from the server
+ existed := true
+
infos, err := checkEthstats(client, w.network)
if err != nil {
infos = &ethstatsInfos{
@@ -41,6 +43,7 @@ func (w *wizard) deployEthstats() {
host: client.server,
secret: "",
}
+ existed = false
}
// Figure out which port to listen on
fmt.Println()
@@ -62,46 +65,50 @@ func (w *wizard) deployEthstats() {
infos.secret = w.readDefaultString(infos.secret)
}
// Gather any blacklists to ban from reporting
- fmt.Println()
- fmt.Printf("Keep existing IP %v blacklist (y/n)? (default = yes)\n", infos.banned)
- if w.readDefaultString("y") != "y" {
- // The user might want to clear the entire list, although generally probably not
- fmt.Println()
- fmt.Printf("Clear out blacklist and start over (y/n)? (default = no)\n")
- if w.readDefaultString("n") != "n" {
- infos.banned = nil
- }
- // Offer the user to explicitly add/remove certain IP addresses
+ if existed {
fmt.Println()
- fmt.Println("Which additional IP addresses should be blacklisted?")
- for {
- if ip := w.readIPAddress(); ip != "" {
- infos.banned = append(infos.banned, ip)
- continue
+ fmt.Printf("Keep existing IP %v blacklist (y/n)? (default = yes)\n", infos.banned)
+ if w.readDefaultString("y") != "y" {
+ // The user might want to clear the entire list, although generally probably not
+ fmt.Println()
+ fmt.Printf("Clear out blacklist and start over (y/n)? (default = no)\n")
+ if w.readDefaultString("n") != "n" {
+ infos.banned = nil
}
- break
- }
- fmt.Println()
- fmt.Println("Which IP addresses should not be blacklisted?")
- for {
- if ip := w.readIPAddress(); ip != "" {
- for i, addr := range infos.banned {
- if ip == addr {
- infos.banned = append(infos.banned[:i], infos.banned[i+1:]...)
- break
+ // Offer the user to explicitly add/remove certain IP addresses
+ fmt.Println()
+ fmt.Println("Which additional IP addresses should be blacklisted?")
+ for {
+ if ip := w.readIPAddress(); ip != "" {
+ infos.banned = append(infos.banned, ip)
+ continue
+ }
+ break
+ }
+ fmt.Println()
+ fmt.Println("Which IP addresses should not be blacklisted?")
+ for {
+ if ip := w.readIPAddress(); ip != "" {
+ for i, addr := range infos.banned {
+ if ip == addr {
+ infos.banned = append(infos.banned[:i], infos.banned[i+1:]...)
+ break
+ }
}
+ continue
}
- continue
+ break
}
- break
+ sort.Strings(infos.banned)
}
- sort.Strings(infos.banned)
}
// Try to deploy the ethstats server on the host
- fmt.Println()
- fmt.Printf("Should the ethstats be built from scratch (y/n)? (default = no)\n")
- nocache := w.readDefaultString("n") != "n"
-
+ nocache := false
+ if existed {
+ fmt.Println()
+ fmt.Printf("Should the ethstats be built from scratch (y/n)? (default = no)\n")
+ nocache = w.readDefaultString("n") != "n"
+ }
trusted := make([]string, 0, len(w.servers))
for _, client := range w.servers {
if client != nil {