-
Notifications
You must be signed in to change notification settings - Fork 976
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
kad: emit ToSwarm::NewExternalAddrOfPeer
#5103
Comments
would like to work on this |
would work on mDNS and DHT simultaneously, you can assign me this as well |
Make them two PRs please! :) |
unsure whether this one is taken but seem prev one has made such claim and not submit pattern in some other repo couple times.. |
You are welcome to work on this too! |
Hi, do you mind if I try to do this? I know a little bit of Rust, but this is my first time contributing to a p2p related library, so if you don't mind, is there any code or documentation that would help me solve this issue? |
@blacktoast are you still interested in tackling this issue? |
Hi guys, I saw that this ticket was stale for some time so I gave it a try at #5549 . Let me know what you think 🙂 |
## Description <!-- Please write a summary of your changes and why you made them. This section will appear as the commit message after merging. Please craft it accordingly. For a quick primer on good commit messages, check out this blog post: https://cbea.ms/git-commit/ Please include any relevant issues in here, for example: Related https://github.com/libp2p/rust-libp2p/issues/ABCD. Fixes https://github.com/libp2p/rust-libp2p/issues/XYZ. --> Updates `libp2p-kad` to emit new event `ToSwarm::NewExternalAddrOfPeer` whenever it discovers a new address through the DHT. Related: #5103 ## Notes & open questions <!-- Any notes, remarks or open questions you have to make about the PR which don't need to go into the final commit message. --> ## Change checklist <!-- Please add a Changelog entry in the appropriate crates and bump the crate versions if needed. See <https://github.com/libp2p/rust-libp2p/blob/master/docs/release.md#development-between-releases>--> - [X] I have performed a self-review of my own code - [ ] I have made corresponding changes to the documentation - [X] I have added tests that prove my fix is effective or that my feature works - [ ] A changelog entry has been made in the appropriate crates --------- Co-authored-by: Guillaume Michel <[email protected]>
Following up the discussion from the merged PR #5549. With #5549 a I agree with @Wiezzel that it would be best to emit the event when the address is discovered, so that an event is emitted for all (newly) discovered peers. Though as we don't have a peerstore, it means that there may be many events emitted for the same node (and same address) every time the node is included a kad response. We could keep a state per query, which would already limit the number of duplicates, and not generate an event for peers that are already in the routing table, but even then these event will be noisy. |
I kind of agree that we should probably emit on newly discovered external addresses and not just when adding to the routing table (which is the purpose of the event anyway). |
Agreed. I will check what is the best place to move this, so I can do a fix pr if you agree. Any pointers are welcome! |
## Description <!-- Please write a summary of your changes and why you made them. This section will appear as the commit message after merging. Please craft it accordingly. For a quick primer on good commit messages, check out this blog post: https://cbea.ms/git-commit/ Please include any relevant issues in here, for example: Related https://github.com/libp2p/rust-libp2p/issues/ABCD. Fixes https://github.com/libp2p/rust-libp2p/issues/XYZ. --> Updates `libp2p-kad` to emit new event `ToSwarm::NewExternalAddrOfPeer` whenever it discovers a new address through the DHT. Related: libp2p#5103 ## Notes & open questions <!-- Any notes, remarks or open questions you have to make about the PR which don't need to go into the final commit message. --> ## Change checklist <!-- Please add a Changelog entry in the appropriate crates and bump the crate versions if needed. See <https://github.com/libp2p/rust-libp2p/blob/master/docs/release.md#development-between-releases>--> - [X] I have performed a self-review of my own code - [ ] I have made corresponding changes to the documentation - [X] I have added tests that prove my fix is effective or that my feature works - [ ] A changelog entry has been made in the appropriate crates --------- Co-authored-by: Guillaume Michel <[email protected]>
Is this done? #5549 has been merged. |
👍 yes, thanks. |
Is it but it looks like discussion was going to continue to determine if we should emit only when adding to the kbucket or upon discovery of any peers regardless of their position in the kbucket. Not sure that been resolved, has it? |
You're right, I should have scrolled down more on that PR 😄. Still, I would consider the current issue to be resolved, kademlia does emit a |
Description
With #4371 merged, we have the foundation of #4302 implemented.
libp2p-kad
needs to be extended to emit this new event whenever it discovers a new address through the DHT.Motivation
Other behaviours should be able to learn the addresses discovered by kademlia.
Current Implementation
Only kademlia knows about its discovered addresses.
Are you planning to do it yourself in a pull request ?
No
The text was updated successfully, but these errors were encountered: