openmina_bootstrap_sandbox/
behaviour.rs1use libp2p_rpc_behaviour::Behaviour as RpcBehaviour;
2
3use libp2p::{swarm::NetworkBehaviour, PeerId};
4
5#[derive(NetworkBehaviour)]
6#[behaviour(to_swarm = "Event")]
7pub struct Behaviour {
8 pub rpc: RpcBehaviour,
9 pub identify: libp2p::identify::Behaviour,
10}
11
12pub enum Event {
13 Rpc((PeerId, libp2p_rpc_behaviour::Event)),
14 Identify,
15}
16
17impl From<(PeerId, libp2p_rpc_behaviour::Event)> for Event {
18 fn from(value: (PeerId, libp2p_rpc_behaviour::Event)) -> Self {
19 Self::Rpc(value)
20 }
21}
22
23impl From<libp2p::identify::Event> for Event {
24 fn from(_value: libp2p::identify::Event) -> Self {
25 Self::Identify
27 }
28}