reth_network_types/peers/
kind.rs

1//! Classification of a peer based on trust.
2
3/// Represents the kind of peer
4#[derive(Debug, Clone, Copy, Default, Eq, PartialEq)]
5pub enum PeerKind {
6    /// Basic peer kind.
7    #[default]
8    Basic,
9    /// Static peer, added via JSON-RPC.
10    Static,
11    /// Trusted peer.
12    Trusted,
13}
14
15impl PeerKind {
16    /// Returns `true` if the peer is trusted.
17    pub const fn is_trusted(&self) -> bool {
18        matches!(self, Self::Trusted)
19    }
20
21    /// Returns `true` if the peer is static.
22    pub const fn is_static(&self) -> bool {
23        matches!(self, Self::Static)
24    }
25
26    /// Returns `true` if the peer is basic.
27    pub const fn is_basic(&self) -> bool {
28        matches!(self, Self::Basic)
29    }
30}