aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/puppeth/wizard_ethstats.go
diff options
context:
space:
mode:
authorJanos Guljas <janos@resenje.org>2017-12-13 17:23:11 +0800
committerJanos Guljas <janos@resenje.org>2017-12-13 17:40:39 +0800
commit19982f946735948478b6b7e7706f1b615f171d0d (patch)
treecbacbdb6f9e6e731c2ebc17bad74e875f4d8ea8b /cmd/puppeth/wizard_ethstats.go
parent1dc19de5da64962a98a37bbc7b93a3895d2eb6e6 (diff)
parent32516c768ec09e2a71cab5983d2c8b8ae5d92fc7 (diff)
downloadgo-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.tar
go-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.tar.gz
go-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.tar.bz2
go-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.tar.lz
go-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.tar.xz
go-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.tar.zst
go-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.zip
swarm, cmd/swarm: Merge branch 'master' into multiple-ens-endpoints
Merge with changes that implement config file PR #15548. Field *EnsApi string* in swarm/api.Config is replaced with *EnsAPIs []string*. A new field *EnsDisabled bool* is added to swarm/api.Config for easy way to disable ENS resolving with config file. Signature of function swarm.NewSwarm is changed and simplified.
Diffstat (limited to 'cmd/puppeth/wizard_ethstats.go')
-rw-r--r--cmd/puppeth/wizard_ethstats.go70
1 files changed, 40 insertions, 30 deletions
diff --git a/cmd/puppeth/wizard_ethstats.go b/cmd/puppeth/wizard_ethstats.go
index 8bfa1d6e5..fb2529c26 100644
--- a/cmd/puppeth/wizard_ethstats.go
+++ b/cmd/puppeth/wizard_ethstats.go
@@ -42,6 +42,8 @@ func (w *wizard) deployEthstats() {
secret: "",
}
}
+ existed := err == nil
+
// Figure out which port to listen on
fmt.Println()
fmt.Printf("Which port should ethstats listen on? (default = %d)\n", infos.port)
@@ -62,49 +64,57 @@ 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
+ if existed {
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
- 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
+ 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 {
trusted = append(trusted, client.address)
}
}
- if out, err := deployEthstats(client, w.network, infos.port, infos.secret, infos.host, trusted, infos.banned); err != nil {
+ if out, err := deployEthstats(client, w.network, infos.port, infos.secret, infos.host, trusted, infos.banned, nocache); err != nil {
log.Error("Failed to deploy ethstats container", "err", err)
if len(out) > 0 {
fmt.Printf("%s\n", out)
@@ -112,5 +122,5 @@ func (w *wizard) deployEthstats() {
return
}
// All ok, run a network scan to pick any changes up
- w.networkStats(false)
+ w.networkStats()
}