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

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

View File

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