1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
use iroh_bitswap::BitswapEvent;
use libp2p::{
autonat, dcutr, gossipsub::GossipsubEvent, identify::Event as IdentifyEvent,
kad::KademliaEvent, mdns::Event as MdnsEvent, ping::Event as PingEvent, relay,
};
use super::peer_manager::PeerManagerEvent;
#[derive(Debug)]
pub enum Event {
Ping(PingEvent),
Identify(Box<IdentifyEvent>),
Kademlia(KademliaEvent),
Mdns(MdnsEvent),
Bitswap(BitswapEvent),
Autonat(autonat::Event),
Relay(relay::v2::relay::Event),
RelayClient(relay::v2::client::Event),
Dcutr(dcutr::behaviour::Event),
Gossipsub(GossipsubEvent),
PeerManager(PeerManagerEvent),
}
impl From<PingEvent> for Event {
fn from(event: PingEvent) -> Self {
Event::Ping(event)
}
}
impl From<IdentifyEvent> for Event {
fn from(event: IdentifyEvent) -> Self {
Event::Identify(Box::new(event))
}
}
impl From<KademliaEvent> for Event {
fn from(event: KademliaEvent) -> Self {
Event::Kademlia(event)
}
}
impl From<MdnsEvent> for Event {
fn from(event: MdnsEvent) -> Self {
Event::Mdns(event)
}
}
impl From<BitswapEvent> for Event {
fn from(event: BitswapEvent) -> Self {
Event::Bitswap(event)
}
}
impl From<GossipsubEvent> for Event {
fn from(event: GossipsubEvent) -> Self {
Event::Gossipsub(event)
}
}
impl From<autonat::Event> for Event {
fn from(event: autonat::Event) -> Self {
Event::Autonat(event)
}
}
impl From<relay::v2::relay::Event> for Event {
fn from(event: relay::v2::relay::Event) -> Self {
Event::Relay(event)
}
}
impl From<relay::v2::client::Event> for Event {
fn from(event: relay::v2::client::Event) -> Self {
Event::RelayClient(event)
}
}
impl From<dcutr::behaviour::Event> for Event {
fn from(event: dcutr::behaviour::Event) -> Self {
Event::Dcutr(event)
}
}
impl From<PeerManagerEvent> for Event {
fn from(event: PeerManagerEvent) -> Self {
Event::PeerManager(event)
}
}