-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add an AddressBook to Swarm
#2133
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
Conversation
For now, the `Swarm` doesn't do anything with this, we are just putting infrastructure in place.
d3b6d3c to
ee9c923
Compare
|
I'd like to point to https://github.com/ipfs-rust/ipfs-embed/blob/master/src/net/peers.rs as a reference of previous work.
|
Thanks! I will definitely take a look to see how this PR can be improved. Please have a look at this discussion as well for some more context on what I am trying to achieve here.
That makes sense although not all addresses of incoming connections will be dialable (TCP's outgoing ports are an issue here f.e.) but it may be worth to try anyway.
I agree that such events would generally be useful. At the moment, I am trying to land an MVP version of address book that allows
As stated in the PR description, I primarily added this for testing purposes. If we find a good way of testing this reliably, I am happy to remove it.
mdns is already reporting its discovered peers via
See (3) in the PR description.
That makes sense, I'll add it to the PR description as a task. Will only proceed if we can get an ACK on the design though! :) |
ee9c923 to
d683921
Compare
Ah without port reuse enabled there will certainly be a lot of garbage. But not handling this correctly was actually a bug in actyx at some point. After sim-open lands I think making port-reuse the default may be sensible. Not enabling it just causes a larger test matrix of behaviours, most of which will be untested. |
|
I am having 2nd thoughts on the design of this. Instead of introducing
If we are consistent in the use of
The reason I am proposing this behaviour is because having all On the upside, if we manage to design an |
|
My conclusion from the above post is that we should actually fix Not only is this less invasive but I think it will also already improve how our |
Couple of things to discuss:
AddressBookwithin theSwarmto minimize changes of the public API.SwarmEvent::AddressBookUpdated. This could in theory be removed again if we want to keep changes to the public API as small as possible.Identifyprotocol to use this. I don't know enough aboutKademliato make changes there and I think for the time being (i.e. as long asNetworkBehaviour::addresses_of_peerexists), lettingKademliamanage its own internal address book is actually better.Open questions
Swarm::add_address? Doing so would allow us to simplify the public API of at leastlibp2p-request-responsebut it is also a commitment toSwarmknowing about the address book. With the current API changes (NetworkBehaviourAction::ReportPeerAddrandSwarmEvent::AddressBookUpdated) we could still move into a different direction and f.e. not embed anAddressBookinsideSwarm.libp2p-kademitNetworkBehaviourAction::ReportPeerAddr? This could lead to a very large address book if we are connected to something like the IPFS DHT.Open tasks (once we have consensus on the design)
Mdnsto not useaddresses_of_peerbut report the discovered addresses viaNetworkBehaviourAction::ReportPeerAddr/p2p(Is this actually necessary? I think with [libp2p-dns] Implement/dnsaddrresolution. #1931, we already always append/p2pto a multiaddr before dialling it.)