- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我的新周末项目中,我决定从头开始编写一个 bittorrent 客户端,根本没有准备好使用库。经过两天寻找文档,我已经准备放弃 :smile:。我知道有 BEPs , 但他们还远远不足以理解所有规范。在阅读了更多之后,我认为跟踪器和对等协议(protocol)似乎很旧并且易于理解/实现(是的,我知道,要编写具有平衡、对等选择、优化的好代码,这并不像我刚才说的那样容易,但我只想做一些基础知识来学习,而不是与那里的数十个好客户竞争。)
所以,我决定从 DHT 开始,它似乎是更复杂的部分,而且文档也更少。当您停止寻找 bittorrent DHT 或主线 DHT 并开始寻找 kademlia DHT 时,您将获得更多信息,但如何将它们放在一起并不那么明显。
这是我目前的理解(还有我希望填补的空白):
find_nodes
find_nodes
并将他们的响应添加到我的树info_hash
的 announce_peer
,我应该将其信息保存在本地数据库中(发送者的 info_hash 和 ip/端口)get_peers
和我在我的数据库中的 info_hash
然后我发送信息否则我应该发送我自己的树中更近的节点列表(最接近那个 info_hash)get_peers
时,我将收到对等节点或节点,在后一种情况下,我认为节点更接近 info_hash
而不是我自己的 nodeId
那么,我应该将这些节点添加到我的树中还是基于它们开始一棵新树?info_hash
感兴趣时,我应该在所有地方使用 announce_peer
还是只在靠近 nodeId
的节点上使用 announce_peer
目标 info_hash
?距离足够近多少?此时我有很多节点的 ID 更接近我自己的 ID,关于 info_hash 的信息我不是很感兴趣。
恐怕我有一个巨大的愚蠢问题:我为什么要那样做?
我的意思是:我做所有这些工作的自私原因是为了找到我感兴趣的 info_hash 的同行。我理解一个 info_hash 的信息很可能保存在 ID 更接近该 info_hash 的节点上.因此,如果我创建一个更接近 info_hash 而不是更接近我自己的 ID 的节点树,我找到它的信息的机会就更大(在这一点上,如果你知道这个主题,你已经注意到我是多么迷茫)。
我应该创建多棵树吗?一个给我(用来保存 info_hashes 的信息更接近人们发送给我的 nodeID),另一个树更接近我的每个目标 info_hashes 以便我可以检索它们的信息?
我是否应该创建一个更接近我的节点 ID 的树,并希望在查询这棵树以获取我需要的 info_hashes 时最好?
我是否应该放弃,因为我完全误解了 DHT 背后的想法?
好吧,任何真实的文档、流程图,任何东西都会受到欢迎!
最佳答案
So, I have decided to start by the DHT which seems to the the more complex part and also the less documented.
需要阅读由 Peter Maymounkov 和 David Mazieres 撰写的原始 kademlia 论文“Kademlia:基于 XOR 度量的点对点信息系统”。它在 BEP-5 中很早就被引用
if I receive an announce_peer with an info_hash than I should save its information on a local DB (the info_hash and ip/port of the sender)
您只接受包含先前通过 get_peers
分发的 token 的公告。
when I use get_peers on other nodes I will receive peers or nodes, in the later case I think the nodes are closer to the info_hash and not to my own nodeId so, should I add these nodes to my tree or start a new tree based on them?
您使用临时树 - 或按相对于目标 ID 的联系人 ID 排序的列表 - 进行迭代查找,因为它们与您的节点 ID 不平衡。
when I want to announce I am interested on an info_hash should I use announce_peer everywhere or just to the nodes with nodeId closer to the target info_hash? How much is closer enough?
您执行 get_peers
查找,完成后您向 𝑲 最接近的节点集宣布返回写入 token 并验证响应以确保您确实获得 𝑲。在 bittorrent 𝑲 = 8 的情况下。
my selfish reason to do all this work is to locate peers to the info_hash I'm interested in. I understand that the information of one info_hash is likely to be saved on a node which ID is closer to that info_hash. So my chances to find its information is bigger if I create a tree of nodes closer to the info_hash and not closer to my own ID (at this point, if you know the subject, you already noticed how lost I am).
在进行查找时,您不仅会访问路由表中的节点,还会访问响应中包含的节点。这使它们具有迭代性。每个节点的路由表都偏向于它们自己的 ID,确保响应包括越来越接近目标的邻居。
所以交易是您负责接近您的节点 ID 的信息,而其他节点将提供接近您感兴趣的节点 ID 的信息。因此您的路由表布局为他人服务,他们的路由表布局为您服务。
请注意,此答案中包含的所有信息都可以在 BEP 或 Kademlia 论文中找到。
关于bittorrent DHT 详细规范,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44104242/
我正在考虑使用 bittorrent 解决大型数据传播问题,其中数据源为千万亿级,用户需要高达数 TB 的数据。一些细节 潜在数以百万计的种子数 种子大小从 100Mb 到 100Gb 世界上一组稳定
我阅读了官方文档 here和关于 bittorrent 客户端的维基百科文章 here但找不到跟踪器究竟是如何工作的。根据我的理解,跟踪器应该知道哪个对等方拥有某个文件的哪个片段。例如,客户端 1 有
我第一次使用magnet link 。我很好奇它是如何工作的,因此查阅了规范,但没有找到任何答案。 wiki 表示 xt 表示“精确主题”,后跟带有 SHA1 哈希值的格式(在本例中为 btih)。我
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 6年前关闭。 Improve thi
我的理解是 IPFS 和 Bittorrent Mainline DHT 是建立在分布式哈希表 (Kademlia) 之上的。 他们使用文件哈希作为 Kademlia key 来查找可能具有此文件的对
如果我有两台笔记本电脑并将它们连接到同一个互联网连接,然后使用 BitTorrent 软件下载同一个 torrent 文件,跟踪器会看到什么?以及洪流软件的行为如何? 假设在笔记本电脑 A 中,我开始
如果我有一个没有任何跟踪器的 torrent,并且我刚刚启动了一个 bittorent 客户端,所以我还没有对等点...我如何知道在 DHT 中首先与谁连接?看起来我必须至少知道 DHT 中的一个节点
每次向对等点请求特定文件时,每个对等点是否都成为 DHT 节点?还是节点独立于对等点存在?本质上,你如何成为一个节点?你可以是一个peer而不是一个节点吗? 如果问题太简单(这里是菜鸟),我很抱歉,但
所以下面的请求: torrent.ubuntu.com:6969/announce?info_hash=%02%21%CA%F9j%A3%CB%94%F0%F5%8DE%8Ex%B0%FC4J%D8%
在http://www.bittorrent.org/beps/bep_0005.html ,announce_peer 查询需要一个 token ,该 token 具有 require,“响应先前的
我正在使用TransmissionBT torrent客户端(http://www.transmissionbt.com/)。 是否可以对代码进行简单修改,以便能够以顺序模式(从文件开头)下载文件。这
我有一个关于 torrent 文件的问题。 我知道它包含我需要连接的服务器(用户)列表,用于下载整个文件的一部分。 我的问题是,这是否就是洪流所包含的全部内容?还有更重要的细节吗? 谢谢! 最佳答案
当一个对等体连接到另一个拥有所有片段的对等体时,连接的对等体如何知道它所连接的实际上是一个种子(并且拥有所有片段)?他们之间是否有消息发送? 在像 uTorrent 这样的客户端中,对等点似乎也知道它
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 9年前关闭。 Improve this q
使用来自的 torrent 文件 http://torrent.ubuntu.com:6969/ 我正在计算与页面上的哈希匹配的哈希。 然后我向跟踪器发出请求。喜欢 http://torrent.ub
BitTorrent 群中的最佳节点数是多少?我认为有一种数学方法可以表达最有效的节点数。老实说,我有一个问题,即只有经验数量的 X,而没有严格的支持。 根据 this specification数字
在我的新周末项目中,我决定从头开始编写一个 bittorrent 客户端,根本没有准备好使用库。经过两天寻找文档,我已经准备放弃 :smile:。我知道有 BEPs , 但他们还远远不足以理解所有规范
当我使用 torrent 下载 ISO 镜像时;我应该仍然验证文件的完整性(例如通过计算 sha256 哈希),还是在下载时自动完成? 最佳答案 BitTorrent 协议(protocol)具有一种
我正在尝试自己实现 bittorent 协议(protocol),但我在使用 C++ 解码跟踪器响应中的“Peers”值时遇到问题。 根据bittorent协议(protocol)文档: peers:
我使用 BitTorrent,有时会遇到没有种子的文件(缺失部分)。 那时,我们有时会强制结束文件传输并尝试打开未完成的文件(例如图像文件)。 如果幸运的话,即使丢失了某些部分,也可能能够看到下载的图
我是一名优秀的程序员,十分优秀!