-
Notifications
You must be signed in to change notification settings - Fork 950
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
Rework the way one combines NetworkBehaviours together #1021
Comments
Alternatively, a different (and IMO better) long term vision for combining network behaviours together would be to do something like that: let behaviour = Ping::new().join(Identify::new()).join(Kademlia::new());
let swarm = Swarm::new(behaviour, ...); At the moment the problem with that is that we cannot easily express the type of the
So the first step for this issue would be to create a |
Another possibility would be to specialize the |
Digging up this issue.
I think this is the way to go, not only for grouping together network behaviours but also as a general direction. One major pain points of the API of rust-libp2p right now in my opinion is the fact that being generic over a Lines 177 to 206 in 084c7d0
|
I ended up implementing that (in a local branch). I think that doing this would also be a good idea:
|
Related pull request: #1405 |
I don't think we will be doing this any time soon, closing as stale. |
The
NetworkBehaviour
custom derive is a bit weird in terms of API (especially when it comes to the event handling trait and having to override apoll()
function), and is also imprecise in terms of ordering of operations.For example,
addresses_of_peers
is supposed to return the addresses in a specific order, but it is unclear to the user how to influence this order.I think a better solution would be to make the trait easy to implement manually, so that everything is clear.
Additionally, we would provide in libp2p itself some common combinations to easily get started, such as
Ping+Identify+Kademlia+Floodsub+mDNS
.The text was updated successfully, but these errors were encountered: