Crates.io | libp2prs-kad |
lib.rs | libp2prs-kad |
version | 0.3.0 |
source | src |
created_at | 2021-01-14 12:39:43.79994 |
updated_at | 2021-04-23 08:19:48.782065 |
description | Kademlia protocol for libp2p |
homepage | |
repository | https://github.com/netwarps/libp2p-rs |
max_upload_size | |
id | 341892 |
size | 312,361 |
Comparison of kad implementations between rust-libp2p and go-libp2p:
buckets are expanded on demand
no multiaddr, depends on peerstore
insertion:
// TryAddPeer tries to add a peer to the Routing table. // If the peer ALREADY exists in the Routing Table and has been queried before, this call is a no-op. // If the peer ALREADY exists in the Routing Table but hasn't been queried before, we set it's LastUsefulAt value to // the current time. This needs to done because we don't mark peers as "Useful"(by setting the LastUsefulAt value) // when we first connect to them. // // If the peer is a queryPeer i.e. we queried it or it queried us, we set the LastSuccessfulOutboundQuery to the current time. // If the peer is just a peer that we connect to/it connected to us without any DHT query, we consider it as having // no LastSuccessfulOutboundQuery. // // // If the logical bucket to which the peer belongs is full and it's not the last bucket, we try to replace an existing peer // whose LastSuccessfulOutboundQuery is above the maximum allowed threshold in that bucket with the new peer. // If no such peer exists in that bucket, we do NOT add the peer to the Routing Table and return error "ErrPeerRejectedNoCapacity".
// It returns a boolean value set to true if the peer was newly added to the Routing Table, false otherwise. // It also returns any error that occurred while adding the peer to the Routing Table. If the error is not nil, // the boolean value will ALWAYS be false i.e. the peer wont be added to the Routing Table it it's not already there. // // A return value of false with error=nil indicates that the peer ALREADY exists in the Routing Table.
deletion
all buckets are initialized in the beginning
multiaddr embedded in kbuckets
insertion: when Kad protocol is confirmed with remote peer -> inboung/outbound protocol upgrade done
deletion: manual only
update: when peer is found disconnected
NoeStatus: impact how to insert a new peer into RT