Using libp2p, is there a way to write a network behavior that doesn’t hit the entire swarm, but goes directly to a peer and only that peer?
More generally, is there a way within libp2p to communicate exclusively (request/response) to particular peer that you are currently connected to?
One idea is to use gossipsub and subscribe to a specific topic between peers. You can create a custom behaviour that implements gossipsub and request/response. Here is an example of how to implement multiple behaviours in Rust.
I'm trying to do something similar but need multiple peers to subscribe to a topic.
Here is a list of all implementors for the NetworkBehaviour in Rust. At the time of writing, it looks like your options are: