-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove loopback and duplicate addrs in net peers
output
#1199
Conversation
it's up to the reviewers, personally I'd just collect to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! I really like this approach, and it works well!
Againly, nicely done!
it's up to the reviewers, personally I'd just collect to
HashSet<String>
then toVec<String>
in order to get unique addresses, instead of explicitly creatinglet mut seen_addrs: HashSet<Multiaddr> = HashSet::default();
@leviathanbeak I'm not sure I understand this feedback, do you think you could provide an example or maybe suggest a change?
HashSets cannot contain duplicates. Personally I think that approach is much simpler then containing another iterable with seen addresses, so I would like to see if we can incorporate a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comment on HashSet approach
Right, but isn't that the approach already being used? |
@cryptoquick I meant something along these lines (I'm not at my PC)
|
Yup, much cleaner. |
Clever, I like it. @FrancisMurillo Care to make the changes? |
@cryptoquick Happy to make the changes. Just to clarify with |
Ah, makes sense. Are you saying the "no duplicate Multiaddrs" portion of the AC isn't necessary if we filter for only external addresses? That makes sense, since, we shouldn't have duplicate addresses on IP, haha. If I remove that requirement, could the code be simplified? |
60613a0
to
5f130dc
Compare
5f130dc
to
8e79908
Compare
@connormullett Updated to use |
Just reviewed the latest, still works as expected. Thanks for responding to the feedback so quickly, @FrancisMurillo. The code is definitely more succinct now. @connormullett How's that look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much cleaner, thanks for this work! Approved
Summary of changes
Changes introduced in this pull request:
net peers
outputlocalhost
alias, onlyl loopback like127.0.0.1
Reference issue to close (if applicable)
Closes #1184
Other information and links