aboutsummaryrefslogtreecommitdiff
path: root/p2p/src
diff options
context:
space:
mode:
authorhozan23 <hozan23@karyontech.net>2024-05-23 00:21:59 +0200
committerhozan23 <hozan23@karyontech.net>2024-05-23 00:21:59 +0200
commit7be7f59d5caf38ca0cd7a12a937a2cfdca0268d7 (patch)
treee45a49f8ccbf099a4618e5e3fe981a5b1bf9c421 /p2p/src
parent2d1a8aea0b9330cd2eaad26eb187644adad6bed9 (diff)
p2p: add rpc server to monitor example
Diffstat (limited to 'p2p/src')
-rw-r--r--p2p/src/backend.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/p2p/src/backend.rs b/p2p/src/backend.rs
index 0db1cee..98297e5 100644
--- a/p2p/src/backend.rs
+++ b/p2p/src/backend.rs
@@ -25,6 +25,9 @@ pub struct Backend {
/// Identity Key pair
key_pair: KeyPair,
+ /// Peer ID
+ peer_id: PeerID,
+
/// Responsible for network and system monitoring.
monitor: Arc<Monitor>,
@@ -65,6 +68,7 @@ impl Backend {
Arc::new(Self {
key_pair: key_pair.clone(),
+ peer_id,
monitor,
discovery,
config,
@@ -97,8 +101,13 @@ impl Backend {
self.config.clone()
}
+ /// Returns the `PeerID`.
+ pub fn peer_id(&self) -> &PeerID {
+ &self.peer_id
+ }
+
/// Returns the `KeyPair`.
- pub async fn key_pair(&self) -> &KeyPair {
+ pub fn key_pair(&self) -> &KeyPair {
&self.key_pair
}