fix(net): export PeerInfo fields and derive Clone (#977)

This commit is contained in:
mempirate
2023-01-23 13:40:01 +01:00
committed by GitHub
parent c326186397
commit 681f8a601a
3 changed files with 9 additions and 10 deletions

View File

@ -18,4 +18,4 @@ serde = { version = "1.0", features = ["derive"] }
# misc # misc
async-trait = "0.1" async-trait = "0.1"
thiserror = "1.0.37" thiserror = "1.0.37"
tokio = { version = "1.21.2", features = ["sync"] } tokio = { version = "1.21.2", features = ["sync"] }

View File

@ -65,19 +65,18 @@ impl ActiveSessionHandle {
} }
/// Info about an active peer session. /// Info about an active peer session.
#[derive(Debug)] #[derive(Debug, Clone)]
#[allow(unused)]
pub struct PeerInfo { pub struct PeerInfo {
/// Announced capabilities of the peer /// Announced capabilities of the peer
pub(crate) capabilities: Arc<Capabilities>, pub capabilities: Arc<Capabilities>,
/// The identifier of the remote peer /// The identifier of the remote peer
pub(crate) remote_id: PeerId, pub remote_id: PeerId,
/// The client's name and version /// The client's name and version
pub(crate) client_version: String, pub client_version: String,
/// The address we're connected to /// The address we're connected to
pub(crate) remote_addr: SocketAddr, pub remote_addr: SocketAddr,
/// The direction of the session /// The direction of the session
pub(crate) direction: Direction, pub direction: Direction,
} }
/// Events a pending session can produce. /// Events a pending session can produce.

View File

@ -595,8 +595,8 @@ pub(crate) enum PendingSessionHandshakeError {
} }
/// The direction of the connection. /// The direction of the connection.
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub(crate) enum Direction { pub enum Direction {
/// Incoming connection. /// Incoming connection.
Incoming, Incoming,
/// Outgoing connection to a specific node. /// Outgoing connection to a specific node.