diff options
Diffstat (limited to 'p2p')
31 files changed, 110 insertions, 110 deletions
diff --git a/p2p/Cargo.toml b/p2p/Cargo.toml index 31bac2d..441c8f9 100644 --- a/p2p/Cargo.toml +++ b/p2p/Cargo.toml @@ -1,13 +1,13 @@ [package] -name = "karyons_p2p" +name = "karyon_p2p" version.workspace = true edition.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -karyons_core = { workspace = true, features=["crypto"] } -karyons_net.workspace = true +karyon_core = { workspace = true, features=["crypto"] } +karyon_net.workspace = true smol = "1.3.0" async-trait = "0.1.73" diff --git a/p2p/README.md b/p2p/README.md index 098cc26..e00d9e5 100644 --- a/p2p/README.md +++ b/p2p/README.md @@ -1,6 +1,6 @@ -# karyons p2p +# karyon p2p -karyons p2p serves as the foundational stack for the karyons project. It offers +karyon p2p serves as the foundational stack for the karyon project. It offers a lightweight, extensible, and customizable peer-to-peer (p2p) network stack that seamlessly integrates with any p2p project. @@ -8,11 +8,11 @@ that seamlessly integrates with any p2p project. ### Discovery -karyons p2p uses a customized version of the Kademlia for discovering new peers +karyon p2p uses a customized version of the Kademlia for discovering new peers in the network. This approach is based on Kademlia but with several significant differences and optimizations. Some of the main changes: -1. karyons p2p uses TCP for the lookup process, while UDP is used for +1. karyon p2p uses TCP for the lookup process, while UDP is used for validating and refreshing the routing table. The reason for this choice is that the lookup process is infrequent, and the work required to manage messages with UDP is largely equivalent to using TCP for this purpose. @@ -21,11 +21,11 @@ differences and optimizations. Some of the main changes: use UDP. 2. In contrast to traditional Kademlia, which often employs 160 buckets, - karyons p2p reduces the number of buckets to 32. This optimization is a + karyon p2p reduces the number of buckets to 32. This optimization is a result of the observation that most nodes tend to map into the last few buckets, with the majority of other buckets remaining empty. -3. While Kademlia typically uses a 160-bit key to identify a peer, karyons p2p +3. While Kademlia typically uses a 160-bit key to identify a peer, karyon p2p uses a 256-bit key. > Despite criticisms of Kademlia's vulnerabilities, particularly concerning @@ -38,7 +38,7 @@ differences and optimizations. Some of the main changes: ### Peer ID -In the karyons p2p network, each peer is identified by a 256-bit (32-byte) Peer ID. +In the karyon p2p network, each peer is identified by a 256-bit (32-byte) Peer ID. ### Seeding @@ -67,8 +67,8 @@ is added to the `PeerPool`. ### Protocols -In the karyons p2p network, we have two types of protocols: core protocols and -custom protocols. Core protocols are prebuilt into karyons p2p, such as the +In the karyon p2p network, we have two types of protocols: core protocols and +custom protocols. Core protocols are prebuilt into karyon p2p, such as the Ping protocol used to maintain connections. Custom protocols, on the other hand, are protocols that you define for your application to provide its core functionality. @@ -138,5 +138,5 @@ If you have tmux installed, you can run the network simulation script in the examples directory to run 12 peers simultaneously. ```bash -$ RUST_LOG=karyons=info ./net_simulation.sh +$ RUST_LOG=karyon=info ./net_simulation.sh ``` diff --git a/p2p/examples/chat.rs b/p2p/examples/chat.rs index 99cde7b..cc822d9 100644 --- a/p2p/examples/chat.rs +++ b/p2p/examples/chat.rs @@ -7,10 +7,10 @@ use async_trait::async_trait; use clap::Parser; use smol::{channel, Executor}; -use karyons_core::crypto::{KeyPair, KeyPairType}; -use karyons_net::{Endpoint, Port}; +use karyon_core::crypto::{KeyPair, KeyPairType}; +use karyon_net::{Endpoint, Port}; -use karyons_p2p::{ +use karyon_p2p::{ protocol::{ArcProtocol, Protocol, ProtocolEvent, ProtocolID}, ArcPeer, Backend, Config, P2pError, Version, }; diff --git a/p2p/examples/chat_simulation.sh b/p2p/examples/chat_simulation.sh index 82bbe96..0cc63cc 100755 --- a/p2p/examples/chat_simulation.sh +++ b/p2p/examples/chat_simulation.sh @@ -3,23 +3,23 @@ # build cargo build --release --example chat -tmux new-session -d -s karyons_chat +tmux new-session -d -s karyon_chat -tmux send-keys -t karyons_chat "../../target/release/examples/chat --username 'user1'\ +tmux send-keys -t karyon_chat "../../target/release/examples/chat --username 'user1'\ -l 'tcp://127.0.0.1:40000' -d '40010'" Enter -tmux split-window -h -t karyons_chat -tmux send-keys -t karyons_chat "../../target/release/examples/chat --username 'user2'\ +tmux split-window -h -t karyon_chat +tmux send-keys -t karyon_chat "../../target/release/examples/chat --username 'user2'\ -l 'tcp://127.0.0.1:40001' -d '40011' -b 'tcp://127.0.0.1:40010 ' " Enter -tmux split-window -h -t karyons_chat -tmux send-keys -t karyons_chat "../../target/release/examples/chat --username 'user3'\ +tmux split-window -h -t karyon_chat +tmux send-keys -t karyon_chat "../../target/release/examples/chat --username 'user3'\ -l 'tcp://127.0.0.1:40002' -d '40012' -b 'tcp://127.0.0.1:40010'" Enter -tmux split-window -h -t karyons_chat -tmux send-keys -t karyons_chat "../../target/release/examples/chat --username 'user4'\ +tmux split-window -h -t karyon_chat +tmux send-keys -t karyon_chat "../../target/release/examples/chat --username 'user4'\ -b 'tcp://127.0.0.1:40010'" Enter tmux select-layout tiled -tmux attach -t karyons_chat +tmux attach -t karyon_chat diff --git a/p2p/examples/monitor.rs b/p2p/examples/monitor.rs index 0b6571c..b074352 100644 --- a/p2p/examples/monitor.rs +++ b/p2p/examples/monitor.rs @@ -5,10 +5,10 @@ use std::sync::Arc; use clap::Parser; use smol::{channel, Executor}; -use karyons_core::crypto::{KeyPair, KeyPairType}; -use karyons_net::{Endpoint, Port}; +use karyon_core::crypto::{KeyPair, KeyPairType}; +use karyon_net::{Endpoint, Port}; -use karyons_p2p::{Backend, Config}; +use karyon_p2p::{Backend, Config}; use shared::run_executor; diff --git a/p2p/examples/net_simulation.sh b/p2p/examples/net_simulation.sh index dd489e5..7cb8410 100755 --- a/p2p/examples/net_simulation.sh +++ b/p2p/examples/net_simulation.sh @@ -3,71 +3,71 @@ # build cargo build --release --example peer -tmux new-session -d -s karyons_p2p +tmux new-session -d -s karyon_p2p -tmux send-keys -t karyons_p2p "../../target/release/examples/peer\ +tmux send-keys -t karyon_p2p "../../target/release/examples/peer\ -l 'tcp://127.0.0.1:30000' -d '30010'" Enter -tmux split-window -h -t karyons_p2p -tmux send-keys -t karyons_p2p "../../target/release/examples/peer\ +tmux split-window -h -t karyon_p2p +tmux send-keys -t karyon_p2p "../../target/release/examples/peer\ -l 'tcp://127.0.0.1:30001' -d '30011' -b 'tcp://127.0.0.1:30010 ' " Enter -tmux split-window -h -t karyons_p2p -tmux send-keys -t karyons_p2p "../../target/release/examples/peer\ +tmux split-window -h -t karyon_p2p +tmux send-keys -t karyon_p2p "../../target/release/examples/peer\ -l 'tcp://127.0.0.1:30002' -d '30012' -b 'tcp://127.0.0.1:30010'" Enter -tmux split-window -h -t karyons_p2p -tmux send-keys -t karyons_p2p "../../target/release/examples/peer\ +tmux split-window -h -t karyon_p2p +tmux send-keys -t karyon_p2p "../../target/release/examples/peer\ -l 'tcp://127.0.0.1:30003' -d '30013' -b 'tcp://127.0.0.1:30010'" Enter -tmux split-window -h -t karyons_p2p -tmux send-keys -t karyons_p2p "../../target/release/examples/peer\ +tmux split-window -h -t karyon_p2p +tmux send-keys -t karyon_p2p "../../target/release/examples/peer\ -l 'tcp://127.0.0.1:30004' -d '30014' -b 'tcp://127.0.0.1:30010'" Enter -tmux split-window -h -t karyons_p2p -tmux send-keys -t karyons_p2p "../../target/release/examples/peer\ +tmux split-window -h -t karyon_p2p +tmux send-keys -t karyon_p2p "../../target/release/examples/peer\ -l 'tcp://127.0.0.1:30005' -d '30015' -b 'tcp://127.0.0.1:30010'" Enter tmux select-layout even-horizontal sleep 3; -tmux select-pane -t karyons_p2p:0.0 +tmux select-pane -t karyon_p2p:0.0 -tmux split-window -v -t karyons_p2p -tmux send-keys -t karyons_p2p "../../target/release/examples/peer\ +tmux split-window -v -t karyon_p2p +tmux send-keys -t karyon_p2p "../../target/release/examples/peer\ -b 'tcp://127.0.0.1:30010' -b 'tcp://127.0.0.1:30011'" Enter -tmux select-pane -t karyons_p2p:0.2 +tmux select-pane -t karyon_p2p:0.2 -tmux split-window -v -t karyons_p2p -tmux send-keys -t karyons_p2p "../../target/release/examples/peer\ +tmux split-window -v -t karyon_p2p +tmux send-keys -t karyon_p2p "../../target/release/examples/peer\ -b 'tcp://127.0.0.1:30010' -b 'tcp://127.0.0.1:30012' -p 'tcp://127.0.0.1:30005'" Enter -tmux select-pane -t karyons_p2p:0.4 +tmux select-pane -t karyon_p2p:0.4 -tmux split-window -v -t karyons_p2p -tmux send-keys -t karyons_p2p "../../target/release/examples/peer\ +tmux split-window -v -t karyon_p2p +tmux send-keys -t karyon_p2p "../../target/release/examples/peer\ -b 'tcp://127.0.0.1:30010' -b 'tcp://127.0.0.1:30013'" Enter -tmux select-pane -t karyons_p2p:0.6 +tmux select-pane -t karyon_p2p:0.6 -tmux split-window -v -t karyons_p2p -tmux send-keys -t karyons_p2p "../../target/release/examples/peer\ +tmux split-window -v -t karyon_p2p +tmux send-keys -t karyon_p2p "../../target/release/examples/peer\ -b 'tcp://127.0.0.1:30010' -b 'tcp://127.0.0.1:30014'" Enter -tmux select-pane -t karyons_p2p:0.8 +tmux select-pane -t karyon_p2p:0.8 -tmux split-window -v -t karyons_p2p -tmux send-keys -t karyons_p2p "../../target/release/examples/peer\ +tmux split-window -v -t karyon_p2p +tmux send-keys -t karyon_p2p "../../target/release/examples/peer\ -b 'tcp://127.0.0.1:30010' -b 'tcp://127.0.0.1:30015'" Enter -tmux select-pane -t karyons_p2p:0.10 +tmux select-pane -t karyon_p2p:0.10 -tmux split-window -v -t karyons_p2p -tmux send-keys -t karyons_p2p "../../target/release/examples/peer\ +tmux split-window -v -t karyon_p2p +tmux send-keys -t karyon_p2p "../../target/release/examples/peer\ -b 'tcp://127.0.0.1:30010' -b 'tcp://127.0.0.1:30015' -b 'tcp://127.0.0.1:30011'" Enter -# tmux set-window-option -t karyons_p2p synchronize-panes on +# tmux set-window-option -t karyon_p2p synchronize-panes on -tmux attach -t karyons_p2p +tmux attach -t karyon_p2p diff --git a/p2p/examples/peer.rs b/p2p/examples/peer.rs index c0b05c6..06586b6 100644 --- a/p2p/examples/peer.rs +++ b/p2p/examples/peer.rs @@ -5,10 +5,10 @@ use std::sync::Arc; use clap::Parser; use smol::{channel, Executor}; -use karyons_core::crypto::{KeyPair, KeyPairType}; -use karyons_net::{Endpoint, Port}; +use karyon_core::crypto::{KeyPair, KeyPairType}; +use karyon_net::{Endpoint, Port}; -use karyons_p2p::{Backend, Config}; +use karyon_p2p::{Backend, Config}; use shared::run_executor; diff --git a/p2p/examples/shared/mod.rs b/p2p/examples/shared/mod.rs index 9a8e387..aad40d7 100644 --- a/p2p/examples/shared/mod.rs +++ b/p2p/examples/shared/mod.rs @@ -3,7 +3,7 @@ use std::{num::NonZeroUsize, thread}; use easy_parallel::Parallel; use smol::{channel, future, future::Future}; -use karyons_core::Executor; +use karyon_core::Executor; /// Returns an estimate of the default amount of parallelism a program should use. /// see `std::thread::available_parallelism` diff --git a/p2p/src/backend.rs b/p2p/src/backend.rs index f0740b1..703e7de 100644 --- a/p2p/src/backend.rs +++ b/p2p/src/backend.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use log::info; -use karyons_core::{crypto::KeyPair, pubsub::Subscription, GlobalExecutor}; +use karyon_core::{crypto::KeyPair, pubsub::Subscription, GlobalExecutor}; use crate::{ config::Config, diff --git a/p2p/src/codec.rs b/p2p/src/codec.rs index e521824..726a2f7 100644 --- a/p2p/src/codec.rs +++ b/p2p/src/codec.rs @@ -2,12 +2,12 @@ use std::time::Duration; use bincode::{Decode, Encode}; -use karyons_core::{ +use karyon_core::{ async_util::timeout, util::{decode, encode, encode_into_slice}, }; -use karyons_net::{Connection, NetError}; +use karyon_net::{Connection, NetError}; use crate::{ message::{NetMsg, NetMsgCmd, NetMsgHeader, MAX_ALLOWED_MSG_SIZE, MSG_HEADER_SIZE}, diff --git a/p2p/src/config.rs b/p2p/src/config.rs index 2c5d5ec..fffbebd 100644 --- a/p2p/src/config.rs +++ b/p2p/src/config.rs @@ -1,4 +1,4 @@ -use karyons_net::{Endpoint, Port}; +use karyon_net::{Endpoint, Port}; use crate::Version; diff --git a/p2p/src/connection.rs b/p2p/src/connection.rs index e0a3bbd..9fa57cb 100644 --- a/p2p/src/connection.rs +++ b/p2p/src/connection.rs @@ -2,8 +2,8 @@ use std::{collections::VecDeque, fmt, sync::Arc}; use smol::{channel::Sender, lock::Mutex}; -use karyons_core::async_util::CondVar; -use karyons_net::Conn; +use karyon_core::async_util::CondVar; +use karyon_net::Conn; use crate::Result; diff --git a/p2p/src/connector.rs b/p2p/src/connector.rs index 835b1c9..12fbaed 100644 --- a/p2p/src/connector.rs +++ b/p2p/src/connector.rs @@ -2,12 +2,12 @@ use std::{future::Future, sync::Arc}; use log::{error, trace, warn}; -use karyons_core::{ +use karyon_core::{ async_util::{Backoff, TaskGroup, TaskResult}, crypto::KeyPair, GlobalExecutor, }; -use karyons_net::{dial, tls, Conn, Endpoint, NetError}; +use karyon_net::{dial, tls, Conn, Endpoint, NetError}; use crate::{ monitor::{ConnEvent, Monitor}, @@ -146,6 +146,6 @@ impl Connector { } else { dial(endpoint).await } - .map_err(Error::KaryonsNet) + .map_err(Error::KaryonNet) } } diff --git a/p2p/src/discovery/lookup.rs b/p2p/src/discovery/lookup.rs index aefc3a0..1d73306 100644 --- a/p2p/src/discovery/lookup.rs +++ b/p2p/src/discovery/lookup.rs @@ -5,9 +5,9 @@ use log::{error, trace}; use rand::{rngs::OsRng, seq::SliceRandom, RngCore}; use smol::lock::{Mutex, RwLock}; -use karyons_core::{async_util::timeout, crypto::KeyPair, util::decode, GlobalExecutor}; +use karyon_core::{async_util::timeout, crypto::KeyPair, util::decode, GlobalExecutor}; -use karyons_net::{Conn, Endpoint}; +use karyon_net::{Conn, Endpoint}; use crate::{ codec::Codec, diff --git a/p2p/src/discovery/mod.rs b/p2p/src/discovery/mod.rs index 8091991..040a415 100644 --- a/p2p/src/discovery/mod.rs +++ b/p2p/src/discovery/mod.rs @@ -7,13 +7,13 @@ use log::{error, info}; use rand::{rngs::OsRng, seq::SliceRandom}; use smol::lock::Mutex; -use karyons_core::{ +use karyon_core::{ async_util::{Backoff, TaskGroup, TaskResult}, crypto::KeyPair, GlobalExecutor, }; -use karyons_net::{Conn, Endpoint}; +use karyon_net::{Conn, Endpoint}; use crate::{ config::Config, diff --git a/p2p/src/discovery/refresh.rs b/p2p/src/discovery/refresh.rs index 180ac27..ed111fb 100644 --- a/p2p/src/discovery/refresh.rs +++ b/p2p/src/discovery/refresh.rs @@ -9,13 +9,13 @@ use smol::{ Timer, }; -use karyons_core::{ +use karyon_core::{ async_util::{timeout, Backoff, TaskGroup, TaskResult}, util::{decode, encode}, GlobalExecutor, }; -use karyons_net::{dial_udp, listen_udp, Addr, Connection, Endpoint, NetError, Port, UdpConn}; +use karyon_net::{dial_udp, listen_udp, Addr, Connection, Endpoint, NetError, Port, UdpConn}; /// Maximum failures for an entry before removing it from the routing table. pub const MAX_FAILURES: u32 = 3; @@ -200,7 +200,7 @@ impl RefreshService { while retry < self.config.refresh_connect_retries { match self.send_ping_msg(&conn).await { Ok(()) => return Ok(()), - Err(Error::KaryonsNet(NetError::Timeout)) => { + Err(Error::KaryonNet(NetError::Timeout)) => { retry += 1; backoff.sleep().await; } diff --git a/p2p/src/error.rs b/p2p/src/error.rs index 6274d4c..11de0f1 100644 --- a/p2p/src/error.rs +++ b/p2p/src/error.rs @@ -2,7 +2,7 @@ use thiserror::Error as ThisError; pub type Result<T> = std::result::Result<T, Error>; -/// Represents karyons's p2p Error. +/// Represents karyon's p2p Error. #[derive(ThisError, Debug)] pub enum Error { #[error(transparent)] @@ -75,10 +75,10 @@ pub enum Error { ChannelRecv(#[from] smol::channel::RecvError), #[error(transparent)] - KaryonsCore(#[from] karyons_core::error::Error), + KaryonCore(#[from] karyon_core::error::Error), #[error(transparent)] - KaryonsNet(#[from] karyons_net::NetError), + KaryonNet(#[from] karyon_net::NetError), } impl<T> From<smol::channel::SendError<T>> for Error { diff --git a/p2p/src/lib.rs b/p2p/src/lib.rs index 39f4bc1..3605359 100644 --- a/p2p/src/lib.rs +++ b/p2p/src/lib.rs @@ -7,8 +7,8 @@ //! use easy_parallel::Parallel; //! use smol::{channel as smol_channel, future, Executor}; //! -//! use karyons_core::crypto::{KeyPair, KeyPairType}; -//! use karyons_p2p::{Backend, Config, PeerID}; +//! use karyon_core::crypto::{KeyPair, KeyPairType}; +//! use karyon_p2p::{Backend, Config, PeerID}; //! //! let key_pair = KeyPair::generate(&KeyPairType::Ed25519); //! diff --git a/p2p/src/listener.rs b/p2p/src/listener.rs index 416a0d4..ab6f7c1 100644 --- a/p2p/src/listener.rs +++ b/p2p/src/listener.rs @@ -2,13 +2,13 @@ use std::{future::Future, sync::Arc}; use log::{debug, error, info}; -use karyons_core::{ +use karyon_core::{ async_util::{TaskGroup, TaskResult}, crypto::KeyPair, GlobalExecutor, }; -use karyons_net::{listen, tls, Conn, ConnListener, Endpoint}; +use karyon_net::{listen, tls, Conn, ConnListener, Endpoint}; use crate::{ monitor::{ConnEvent, Monitor}, @@ -159,6 +159,6 @@ impl Listener { } else { listen(endpoint).await } - .map_err(Error::KaryonsNet) + .map_err(Error::KaryonNet) } } diff --git a/p2p/src/message.rs b/p2p/src/message.rs index 6b23322..1342110 100644 --- a/p2p/src/message.rs +++ b/p2p/src/message.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use bincode::{Decode, Encode}; -use karyons_net::{Addr, Port}; +use karyon_net::{Addr, Port}; use crate::{protocol::ProtocolID, routing_table::Entry, version::VersionInt, PeerID}; diff --git a/p2p/src/monitor.rs b/p2p/src/monitor.rs index 1ea6a0b..b0ce028 100644 --- a/p2p/src/monitor.rs +++ b/p2p/src/monitor.rs @@ -2,9 +2,9 @@ use std::fmt; use crate::PeerID; -use karyons_core::pubsub::{ArcPublisher, Publisher, Subscription}; +use karyon_core::pubsub::{ArcPublisher, Publisher, Subscription}; -use karyons_net::Endpoint; +use karyon_net::Endpoint; /// Responsible for network and system monitoring. /// @@ -17,8 +17,8 @@ use karyons_net::Endpoint; /// /// use smol::Executor; /// -/// use karyons_core::crypto::{KeyPair, KeyPairType}; -/// use karyons_p2p::{Config, Backend, PeerID}; +/// use karyon_core::crypto::{KeyPair, KeyPairType}; +/// use karyon_p2p::{Config, Backend, PeerID}; /// /// async { /// diff --git a/p2p/src/peer/mod.rs b/p2p/src/peer/mod.rs index 37c0e2a..1e98f1b 100644 --- a/p2p/src/peer/mod.rs +++ b/p2p/src/peer/mod.rs @@ -10,14 +10,14 @@ use smol::{ lock::RwLock, }; -use karyons_core::{ +use karyon_core::{ async_util::{select, Either, TaskGroup, TaskResult}, event::{ArcEventSys, EventListener, EventSys}, util::{decode, encode}, GlobalExecutor, }; -use karyons_net::Endpoint; +use karyon_net::Endpoint; use crate::{ codec::{Codec, CodecMsg}, diff --git a/p2p/src/peer/peer_id.rs b/p2p/src/peer/peer_id.rs index 0208e05..f907aa7 100644 --- a/p2p/src/peer/peer_id.rs +++ b/p2p/src/peer/peer_id.rs @@ -2,7 +2,7 @@ use bincode::{Decode, Encode}; use rand::{rngs::OsRng, RngCore}; use sha2::{Digest, Sha256}; -use karyons_core::crypto::PublicKey; +use karyon_core::crypto::PublicKey; use crate::Error; diff --git a/p2p/src/peer_pool.rs b/p2p/src/peer_pool.rs index ee9ebf9..ead6d8f 100644 --- a/p2p/src/peer_pool.rs +++ b/p2p/src/peer_pool.rs @@ -10,13 +10,13 @@ use smol::{ lock::{Mutex, RwLock}, }; -use karyons_core::{ +use karyon_core::{ async_util::{TaskGroup, TaskResult}, util::decode, GlobalExecutor, }; -use karyons_net::Conn; +use karyon_net::Conn; use crate::{ codec::{Codec, CodecMsg}, diff --git a/p2p/src/protocol.rs b/p2p/src/protocol.rs index 7261f19..f28659c 100644 --- a/p2p/src/protocol.rs +++ b/p2p/src/protocol.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use async_trait::async_trait; -use karyons_core::event::EventValue; +use karyon_core::event::EventValue; use crate::{peer::ArcPeer, version::Version, Result}; @@ -37,8 +37,8 @@ impl EventValue for ProtocolEvent { /// use async_trait::async_trait; /// use smol::Executor; /// -/// use karyons_core::crypto::{KeyPair, KeyPairType}; -/// use karyons_p2p::{ +/// use karyon_core::crypto::{KeyPair, KeyPairType}; +/// use karyon_p2p::{ /// protocol::{ArcProtocol, Protocol, ProtocolID, ProtocolEvent}, /// Backend, PeerID, Config, Version, P2pError, ArcPeer}; /// diff --git a/p2p/src/protocols/ping.rs b/p2p/src/protocols/ping.rs index ec7afe2..22c1b3d 100644 --- a/p2p/src/protocols/ping.rs +++ b/p2p/src/protocols/ping.rs @@ -11,14 +11,14 @@ use smol::{ Timer, }; -use karyons_core::{ +use karyon_core::{ async_util::{select, timeout, Either, TaskGroup, TaskResult}, event::EventListener, util::decode, GlobalExecutor, }; -use karyons_net::NetError; +use karyon_net::NetError; use crate::{ peer::ArcPeer, diff --git a/p2p/src/routing_table/entry.rs b/p2p/src/routing_table/entry.rs index c5fa65d..3fc8a6b 100644 --- a/p2p/src/routing_table/entry.rs +++ b/p2p/src/routing_table/entry.rs @@ -1,6 +1,6 @@ use bincode::{Decode, Encode}; -use karyons_net::{Addr, Port}; +use karyon_net::{Addr, Port}; /// Specifies the size of the key, in bytes. pub const KEY_SIZE: usize = 32; diff --git a/p2p/src/routing_table/mod.rs b/p2p/src/routing_table/mod.rs index cfc3128..6854546 100644 --- a/p2p/src/routing_table/mod.rs +++ b/p2p/src/routing_table/mod.rs @@ -11,7 +11,7 @@ pub use entry::{xor_distance, Entry, Key}; use rand::{rngs::OsRng, seq::SliceRandom}; -use karyons_net::Addr; +use karyon_net::Addr; use bucket::BUCKET_SIZE; use entry::KEY_SIZE; @@ -284,7 +284,7 @@ mod tests { use super::bucket::ALL_ENTRY; use super::*; - use karyons_net::Addr; + use karyon_net::Addr; struct Setup { local_key: Key, diff --git a/p2p/src/slots.rs b/p2p/src/slots.rs index d3a1d0a..0ee0b93 100644 --- a/p2p/src/slots.rs +++ b/p2p/src/slots.rs @@ -1,6 +1,6 @@ use std::sync::atomic::{AtomicUsize, Ordering}; -use karyons_core::async_util::CondWait; +use karyon_core::async_util::CondWait; /// Manages available inbound and outbound slots. pub struct ConnectionSlots { diff --git a/p2p/src/tls_config.rs b/p2p/src/tls_config.rs index 5d5e90e..9fe64f5 100644 --- a/p2p/src/tls_config.rs +++ b/p2p/src/tls_config.rs @@ -8,7 +8,7 @@ use async_rustls::rustls::{ use log::error; use x509_parser::{certificate::X509Certificate, parse_x509_certificate}; -use karyons_core::crypto::{KeyPair, KeyPairType, PublicKey}; +use karyon_core::crypto::{KeyPair, KeyPairType, PublicKey}; use crate::{PeerID, Result}; diff --git a/p2p/src/version.rs b/p2p/src/version.rs index a101b28..f5cc1d6 100644 --- a/p2p/src/version.rs +++ b/p2p/src/version.rs @@ -5,12 +5,12 @@ use semver::VersionReq; use crate::{Error, Result}; -/// Represents the network version and protocol version used in karyons p2p. +/// Represents the network version and protocol version used in karyon p2p. /// /// # Example /// /// ``` -/// use karyons_p2p::Version; +/// use karyon_p2p::Version; /// /// let version: Version = "0.2.0, >0.1.0".parse().unwrap(); /// |