-
Notifications
You must be signed in to change notification settings - Fork 106
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
Add basic support for multiaddr addresses and improvement around peer id #75
Conversation
# Get peer info from peer store | ||
addrs = self.peerstore.addrs(peer_id) | ||
|
||
if not addrs: | ||
raise SwarmException("No known addresses to peer") | ||
|
||
# TODO: define logic to choose which address to use, or try them all ? |
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.
I believe we should try them all and use whichever address responds the fastest
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.
This is what the go-libp2p repo is doing at the moment, and there are plans to upgrade it to a smarter dial. I forgot if it's called a traffic shaper or a dial manager. There is a bit of design freedom here. We should participate in the discussion with the rest of the community.
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.
@zixuanzh do you have a link to the issue where they discuss this dial manager ?
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.
@zaibon this is the thread libp2p/go-libp2p-swarm#88, dial manager might be a make-up name.
Hi @zaibon, is this PR intented to be merged right now? Some of the tests are failing, please fix before merging |
@stuckinaboot With the proper lib installed, I don't have any tests failing, can you point me to which test is not working with you ? |
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.
@zaibon Makes sense, let us check with Raul and see if there are any updates there about ownership transfer of py-multiaddr
to libp2p
but I think it might still take some time. In the mean time, how can we point to your py-multiaddr
fork? We don't see that in your py-libp2p
fork either. If we can try this, then we can retest locally.
What I did is locally install my fork: https://github.com/zaibon/py-multiaddr |
@zaibon I'm trying to recreate this setup - what are the steps I should follow to locally install the fork? Thanks! |
|
Hi @zaibon apologies for the pause in communication. Recently we were focusing on pushing up big design improvements over our PoC (#82 and #83). We have reached out to @raulk regarding the discussion in #65, particularly transferring ownership of sbuss/py-multiaddr to libp2p and accepting the changes in your fork. We haven't heard back yet, but I think we're ready to use your py-multiaddr fork in this repo. Is there a way to integrate your py-multiaddr fork into our Thanks for your great work! |
Hi @robzajac, no worries, I see you're making good progress here. Regarding my fork. I can publish it to pypi so it can be easily integrated with pip and CI. But I guess this will be temporary until we move sbuss/py-multiaddr since I won't be able to use the same package name. But that can be done, no problem. |
no need to cast from a string to an ID
- keep multiaddr object into peerstore instead of string - update network code to use new multiaddr lib - update tests and example
This has side effect where the same peerstore is used for different instance of Libp2p
Codecov Report
@@ Coverage Diff @@
## master #75 +/- ##
=========================================
+ Coverage 53.45% 53.9% +0.44%
=========================================
Files 49 51 +2
Lines 1463 1551 +88
=========================================
+ Hits 782 836 +54
- Misses 681 715 +34
Continue to review full report at Codecov.
|
@robzajac ok I think it's ready now. Please have another look if I didn't mess up with the code. I had to rebase a few commits. |
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.
LGTM! I will let one of @alexh @zixuanzh @stuckinaboot take a look as well.
@@ -56,3 +69,22 @@ def set_stream_handler(self, protocol_id, stream_handler): | |||
""" | |||
stream = await self.network.new_stream(peer_id, protocol_ids) | |||
return stream | |||
|
|||
async def connect(self, peer_info): |
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.
Adding reference if anyone is wondering where this comes from.
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.
LGTM as well, thank you for the great work!
* new issue and pr templates
relates to #65
I'm already creating this PR so my fork doesn't diverge too far away from here.