mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-05-29 02:31:20 +00:00
cleanup
This commit is contained in:
parent
84fc48f1ac
commit
87b8e23553
@ -28,6 +28,7 @@ wasm-timer = "0.2"
|
||||
uint = "0.8"
|
||||
unsigned-varint = { version = "0.3", features = ["futures-codec"] }
|
||||
void = "1.0"
|
||||
bs58 = "0.3.0"
|
||||
|
||||
[dev-dependencies]
|
||||
libp2p-secio = { version = "0.16.0", path = "../secio" }
|
||||
|
@ -14,14 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// TODO: modify src/dht.proto
|
||||
|
||||
|
||||
use crate::Addresses;
|
||||
use libp2p_core::{Multiaddr};
|
||||
use libp2p_core::identity::ed25519::PublicKey;
|
||||
use crate::protocol::KadPeer;
|
||||
use smallvec::SmallVec;
|
||||
use std::fmt::Formatter;
|
||||
use bs58;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
pub struct Contact {
|
||||
@ -68,3 +67,25 @@ impl From<KadPeer> for Contact {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Contact {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"Contact({}, addresses: {:?})",
|
||||
bs58::encode(self.public_key.encode()).into_string(),
|
||||
self.addresses // TODO: implement better display for addresses
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for Contact {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"Contact {{ public_key: {}, addresses: {:?} }}",
|
||||
bs58::encode(self.public_key.encode()).into_string(),
|
||||
self.addresses // TODO: implement better display for addresses
|
||||
)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user