Repository navigation
Replies: 1 comment 1 reply
|
Your reading of the source is right. I went through Where the provider addresses go When a Kademlia also doesn't announce them anywhere else. It emits What works with 0.56 today Dial from inside the // `MyBehaviourEvent::Kad` is whatever your `#[derive(NetworkBehaviour)]` generates for the kad field.
SwarmEvent::Behaviour(MyBehaviourEvent::Kad(kad::Event::OutboundQueryProgressed {
result: kad::QueryResult::GetProviders(Ok(kad::GetProvidersOk::FoundProviders { providers, .. })),
..
})) => {
for peer in providers {
// `Swarm::dial` asks the behaviours for addresses synchronously, so kad
// still sees this query's map here.
let _ = swarm.dial(peer);
}
}This works because Why the success rate is still low: #6696
On your proposal There's a direct precedent. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
EDIT: I'm currently using
libp2p 0.56.0, and I've noticed that0.57.1appears to have introducedlibp2p-peer-store, but I'm not sure how relevant this is to my issue, since the CHANGELOG isn't very detailed, and the API documentation has been broken since0.57.0.I apologize if this question seems silly. Please allow me to outline what I'm currently working on, and then I'll ask my question at the end.
get_providersto query the providers for an IPFS CID, and then connect to some of those providers to request the content.get_providers, I will receive a series ofGetProvidersOkresponses. However,GetProvidersOkonly returns aPeerId. Although thedialfunction accepts aPeerId, a validMultiaddris ultimately required to initiate a dial.dialcan use theMultiaddrs of queries currently in progress in theQueryPool, however, once the query is complete, these addresses are no longer valid fordialbecause they are removed from theQueryPool, and sinceGetProvidersOkreturns onlyPeerId, theseMultiaddrs are ultimately discarded.dialis called during the query process, the probability of successfully establishing a connection remains limited.The above things are based on my review of the source code and my experiments. I don't know to what extent they reflect reality, but I did my best.
Anyway, I believe that
GetProvidersOkshould carry aPeerInforather than just aPeerId. The reason is thatGetClosestPeersOkcurrently returns aVec<PeerInfo>, and the functionality ofget_closest_peersandget_providersis similar. Furthermore, this approach would make it easier for the caller to manage these addresses on their own.Given that
libp2pis a project that has been ongoing for several years, and I haven’t been able to find any documentation explaining the design philosophy or guidelines forlibp2p-rust,So I’m not sure if the idea I’ve proposed goes against any principles, and I also do have a lot of questions. So I’d like to know what others think of my idea.
Also, if you have any additional information about
libp2p-rust(e.g. documentation) that you’d be willing to share, I’d greatly appreciate it.All reactions