bittorrent - Kademlia/DHT 如何获取节点 ID 并更新离开 swarm 的对等节点?

标签 bittorrent dht kademlia

我读过论文 Kademlia: A Peer-to-peer Information System Based on the XOR Metric。
但我还有两个问题。

Q1:节点如何获取节点id?

BEP5 说:每个节点都有一个全局唯一标识符,称为“节点 ID”。节点 ID 是从与 BitTorrent infohashes 相同的 160 位空间中随机选择的。

那么如果你随机选择,你如何选择以及如何确保你选择的id是全局唯一的?我的意思是有人可能会选择与您相同的 ID。

Q2:存储键值的节点如何知道某个节点是否离开了集群?

我在第一行提到的论文说:为了补偿离开网络的节点,Kademlia 每小时重新发布一次每个键值对。

但是如果我是节点,我想更新谁还在下载某个文件,我仍然不知道谁离开了群。

最佳答案

Then if you choose at random,how do you choose



带有随机数生成器。

how to make sure the id you choose is globally unique?



有人随机选择相同的节点 ID 是极不可能的。 key 空间的大小为 160 位。那是 2^160 种可能性。这比地球的原子数略少。

Q2: How does the node storing the key-value know if some peer leave the swarm?



它没有。它只是超时未刷新的值。

But if I were the node, i want to update who is still downloading one certain file



DHT 的目标不是准确反射(reflect)谁在下载 Torrent,它只是提供初始联系人以加入群。轻微的不准确并不重要。

关于bittorrent - Kademlia/DHT 如何获取节点 ID 并更新离开 swarm 的对等节点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31364604/

相关文章:

java - 查找文件当前大小与文件标题中的数量 java

c++ - 向跟踪器 Libtorrent 报告种子结束或吸取

python - Libtorrent 设置 download_limit/upload_limit 不起作用

bittorrent - DHT中announce_peer的token

networking - 为什么 Kademlia 使用 UDP?

routing - 在 torrent kademlia 路由表上实现查找节点

c++ - 需要一个使用 dht_put_item 和 libtorrent 的例子

bittorrent - 如何从 DHT 中提取 torrent 文件?

bittorrent - 如何从 torrent-magnet 链接获得第一个对等点?