cmd/puppeth: use dumb textual IP filtering #15269
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Puppeth until now supported blacklisting ethstats peers via their IP addresses by maintaining a slice of Go
net.IP
addresses and flattening it into a string list for the docker config.Unfortunately ethstats uses plain string comparison for IP banning, and Go uses a different IP formatting scheme than nodejs (IPv6 addresses in Go get shortened if they contain
:0:0:0:0
ending to::
). As such, parsing the user input intonet.IP
and later converting to string will mismatch the comparison. This PR dumbs down the blacklist to use[]string
instead of[]net.IP
.Alongside the change, the PR also introduces a bit finer blacklist manipulation support so that Puppeth admins don't have to reconstruct the blacklist every single time they want to add/remove an entry to/from it.