hide public key from Debug

This commit is contained in:
folex 2020-03-28 20:24:55 +03:00
parent d8451e549c
commit b22934be64
4 changed files with 11 additions and 4 deletions

View File

@ -29,6 +29,7 @@ uint = "0.8"
unsigned-varint = { version = "0.3", features = ["futures-codec"] } unsigned-varint = { version = "0.3", features = ["futures-codec"] }
void = "1.0" void = "1.0"
bs58 = "0.3.0" bs58 = "0.3.0"
derivative = "2.0.2"
trust-graph = { git = "ssh://git@github.com/fluencelabs/arqada.git", branch = "libp2p_migration" } trust-graph = { git = "ssh://git@github.com/fluencelabs/arqada.git", branch = "libp2p_migration" }

View File

@ -49,6 +49,7 @@ use std::task::{Context, Poll};
use wasm_timer::Instant; use wasm_timer::Instant;
use libp2p_core::identity::ed25519::{Keypair, PublicKey}; use libp2p_core::identity::ed25519::{Keypair, PublicKey};
use trust_graph::TrustGraph; use trust_graph::TrustGraph;
use derivative::Derivative;
/// Network behaviour that handles Kademlia. /// Network behaviour that handles Kademlia.
pub struct Kademlia<TStore> { pub struct Kademlia<TStore> {
@ -1539,7 +1540,8 @@ impl Quorum {
/// The events produced by the `Kademlia` behaviour. /// The events produced by the `Kademlia` behaviour.
/// ///
/// See [`NetworkBehaviour::poll`]. /// See [`NetworkBehaviour::poll`].
#[derive(Debug)] #[derive(Derivative)]
#[derivative(Debug)]
pub enum KademliaEvent { pub enum KademliaEvent {
/// The result of [`Kademlia::bootstrap`]. /// The result of [`Kademlia::bootstrap`].
BootstrapResult(BootstrapResult), BootstrapResult(BootstrapResult),
@ -1575,6 +1577,7 @@ pub enum KademliaEvent {
/// towards the local peer. /// towards the local peer.
ty: KadConnectionType, ty: KadConnectionType,
/// PublicKey of the discovered peer /// PublicKey of the discovered peer
#[derivative(Debug="ignore")]
public_key: PublicKey public_key: PublicKey
}, },

View File

@ -35,7 +35,8 @@ use futures::prelude::*;
use futures_codec::Framed; use futures_codec::Framed;
use prost::Message; use prost::Message;
use unsigned_varint::codec; use unsigned_varint::codec;
use wasm_timer::Instant; use derivative::Derivative;
use std::time::Instant;
use libp2p_core::{Multiaddr, PeerId}; use libp2p_core::{Multiaddr, PeerId};
use libp2p_core::identity::ed25519::PublicKey; use libp2p_core::identity::ed25519::PublicKey;
@ -85,8 +86,10 @@ impl Into<proto::message::ConnectionType> for KadConnectionType {
} }
/// Information about a peer, as known by the sender. /// Information about a peer, as known by the sender.
#[derive(Debug, Clone, PartialEq, Eq)] #[derive(Derivative)]
#[derivative(Debug, Clone, PartialEq, Eq)]
pub struct KadPeer { pub struct KadPeer {
#[derivative(Debug="ignore")]
pub public_key: PublicKey, pub public_key: PublicKey,
/// Identifier of the peer. /// Identifier of the peer.
pub node_id: PeerId, pub node_id: PeerId,

View File

@ -112,7 +112,7 @@ pub struct ProviderRecord {
pub provider: PeerId, pub provider: PeerId,
/// The expiration time as measured by a local, monotonic clock. /// The expiration time as measured by a local, monotonic clock.
pub expires: Option<Instant>, pub expires: Option<Instant>,
// pub weight: u32 // pub weight: u32 // TODO: weight
} }
impl Hash for ProviderRecord { impl Hash for ProviderRecord {