aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--p2p/examples/chat.rs5
-rw-r--r--p2p/examples/monitor.rs9
-rw-r--r--p2p/examples/peer.rs9
-rw-r--r--p2p/src/lib.rs8
-rw-r--r--p2p/src/monitor.rs3
-rw-r--r--p2p/src/protocol.rs5
6 files changed, 21 insertions, 18 deletions
diff --git a/p2p/examples/chat.rs b/p2p/examples/chat.rs
index 4eafb07..d120f50 100644
--- a/p2p/examples/chat.rs
+++ b/p2p/examples/chat.rs
@@ -7,10 +7,9 @@ use async_trait::async_trait;
use clap::Parser;
use smol::{channel, Executor};
-use karyon_core::crypto::{KeyPair, KeyPairType};
-use karyon_net::{Endpoint, Port};
-
use karyon_p2p::{
+ endpoint::{Endpoint, Port},
+ keypair::{KeyPair, KeyPairType},
protocol::{ArcProtocol, Protocol, ProtocolEvent, ProtocolID},
ArcPeer, Backend, Config, P2pError, Version,
};
diff --git a/p2p/examples/monitor.rs b/p2p/examples/monitor.rs
index 019f751..5da55aa 100644
--- a/p2p/examples/monitor.rs
+++ b/p2p/examples/monitor.rs
@@ -5,10 +5,11 @@ use std::sync::Arc;
use clap::Parser;
use smol::{channel, Executor};
-use karyon_core::crypto::{KeyPair, KeyPairType};
-use karyon_net::{Endpoint, Port};
-
-use karyon_p2p::{Backend, Config};
+use karyon_p2p::{
+ endpoint::{Endpoint, Port},
+ keypair::{KeyPair, KeyPairType},
+ Backend, Config,
+};
use shared::run_executor;
diff --git a/p2p/examples/peer.rs b/p2p/examples/peer.rs
index db747c9..77bf732 100644
--- a/p2p/examples/peer.rs
+++ b/p2p/examples/peer.rs
@@ -5,10 +5,11 @@ use std::sync::Arc;
use clap::Parser;
use smol::{channel, Executor};
-use karyon_core::crypto::{KeyPair, KeyPairType};
-use karyon_net::{Endpoint, Port};
-
-use karyon_p2p::{Backend, Config};
+use karyon_p2p::{
+ endpoint::{Endpoint, Port},
+ keypair::{KeyPair, KeyPairType},
+ Backend, Config,
+};
use shared::run_executor;
diff --git a/p2p/src/lib.rs b/p2p/src/lib.rs
index fc2c26d..c873980 100644
--- a/p2p/src/lib.rs
+++ b/p2p/src/lib.rs
@@ -7,9 +7,9 @@
//! use easy_parallel::Parallel;
//! use smol::{future, Executor};
//!
-//! use karyon_core::crypto::{KeyPair, KeyPairType};
-//! use karyon_p2p::{Backend, Config, PeerID};
+//! use karyon_p2p::{Backend, Config, PeerID, keypair::{KeyPair, KeyPairType}};
//!
+//! // Generate a new keypair for the peer
//! let key_pair = KeyPair::generate(&KeyPairType::Ed25519);
//!
//! // Create the configuration for the backend.
@@ -23,7 +23,9 @@
//!
//! let task = async {
//! // Run the backend
-//! backend.run().await.unwrap();
+//! backend.run()
+//! .await
+//! .expect("start the backend");
//!
//! // ....
//!
diff --git a/p2p/src/monitor.rs b/p2p/src/monitor.rs
index 48719c0..cbbd40c 100644
--- a/p2p/src/monitor.rs
+++ b/p2p/src/monitor.rs
@@ -17,8 +17,7 @@ use karyon_net::Endpoint;
///
/// use smol::Executor;
///
-/// use karyon_core::crypto::{KeyPair, KeyPairType};
-/// use karyon_p2p::{Config, Backend, PeerID};
+/// use karyon_p2p::{Config, Backend, PeerID, keypair::{KeyPair, KeyPairType}};
///
/// async {
///
diff --git a/p2p/src/protocol.rs b/p2p/src/protocol.rs
index 6153ea1..951040b 100644
--- a/p2p/src/protocol.rs
+++ b/p2p/src/protocol.rs
@@ -37,10 +37,11 @@ impl EventValue for ProtocolEvent {
/// use async_trait::async_trait;
/// use smol::Executor;
///
-/// use karyon_core::crypto::{KeyPair, KeyPairType};
/// use karyon_p2p::{
/// protocol::{ArcProtocol, Protocol, ProtocolID, ProtocolEvent},
-/// Backend, PeerID, Config, Version, P2pError, ArcPeer};
+/// Backend, PeerID, Config, Version, P2pError, ArcPeer,
+/// keypair::{KeyPair, KeyPairType},
+/// };
///
/// pub struct NewProtocol {
/// peer: ArcPeer,