最新的 bittorrent DHT 实施建议是什么?

What are the most recent bittorrent DHT implementation recommendations?

我正在努力实施另一个 bittorrent 客户端,此时正在与 DHT 作斗争。它是根据此规范实施的 http://www.bittorrent.org/beps/bep_0005.html 但开始调试它时我注意到网络上其他节点的响应有所不同。

例如,find_node 应该 return 目标节点信息或 8 个最近的节点。大多数节点回复 34 个最近的节点,通常这 34 个节点中只有 1 - 3 个节点成功回复后续的 ping 请求。

有没有更好的实现建议的文档?可能已经证明使用 15 分钟的间隔将节点状态更改为有问题的效率不高,我必须使用 10 或其他数字?我在哪里可以找到最新的最佳建议?

还有一件奇怪的事。 Bootstrap 像 router.bittorrent.com 这样的节点用更接近的节点回复并且通常 "nodes" BDictionary 属性 缓冲区长度不能被 6 整除(紧凑节点信息:IP 为 4,IP 为 2港口)。现在,我只是简单地切断了最接近 6 整除长度的缓冲区,但这一切都很奇怪。有人知道为什么会这样吗?

规范说(强调我的):

When a node receives a find_node query, it should respond with a key "nodes" and value of a string containing the compact node info for [...]

再往下:

Contact information for nodes is encoded as a 26-byte string. Also known as "Compact node info" the 20-byte Node ID in network byte order has the compact IP-address/port info concatenated to the end.


此外,您应该阅读原始的 Kademlia 论文,因为 bittorrent BEP 建立在其中描述的概念之上,并省略了对这些概念的更深入解释。

您可能还想阅读一些扩展,这些扩展或多或少已成为大多数实现的实际标准 http://libtorrent.org/dht_extensions.html

并阅读其他与 DHT 相关的 BEPs,其中一些被相当广泛地采用并且 modify/clarify BEP-5 指定的行为,但通常以向后兼容的方式。


For example, find_node is supposed to return either target node info or 8 closest nodes

节点将 return 数量可变的条目。可能超过 8 个。或更少。