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?
For everybody who finds this answer post 2022, the preferred solution would be the request-response network behavior.
An example of how to use this library can be found in the library's tests: https://github.com/libp2p/rust-libp2p/blob/master/protocols/request-response/tests/ping.rs