@@ -18,6 +18,7 @@ package main
1818
1919import (
2020 "fmt"
21+ "sort"
2122
2223 "github.com/ethereum/go-ethereum/log"
2324)
@@ -64,17 +65,37 @@ func (w *wizard) deployEthstats() {
6465 fmt .Println ()
6566 fmt .Printf ("Keep existing IP %v blacklist (y/n)? (default = yes)\n " , infos .banned )
6667 if w .readDefaultString ("y" ) != "y" {
67- infos .banned = nil
68-
68+ // The user might want to clear the entire list, although generally probably not
69+ fmt .Println ()
70+ fmt .Printf ("Clear out blacklist and start over (y/n)? (default = no)\n " )
71+ if w .readDefaultString ("n" ) != "n" {
72+ infos .banned = nil
73+ }
74+ // Offer the user to explicitly add/remove certain IP addresses
75+ fmt .Println ()
76+ fmt .Println ("Which additional IP addresses should be blacklisted?" )
77+ for {
78+ if ip := w .readIPAddress (); ip != "" {
79+ infos .banned = append (infos .banned , ip )
80+ continue
81+ }
82+ break
83+ }
6984 fmt .Println ()
70- fmt .Println ("Which IP addresses should be blacklisted?" )
85+ fmt .Println ("Which IP addresses should not be blacklisted?" )
7186 for {
72- if ip := w .readIPAddress (); ip != nil {
73- infos .banned = append (infos .banned , ip .String ())
87+ if ip := w .readIPAddress (); ip != "" {
88+ for i , addr := range infos .banned {
89+ if ip == addr {
90+ infos .banned = append (infos .banned [:i ], infos .banned [i + 1 :]... )
91+ break
92+ }
93+ }
7494 continue
7595 }
7696 break
7797 }
98+ sort .Strings (infos .banned )
7899 }
79100 // Try to deploy the ethstats server on the host
80101 trusted := make ([]string , 0 , len (w .servers ))
0 commit comments