我编写了一个简单的脚本,可以找出给定 info_hash 的示例对等 IP。我在 BEP-0005 中看不到此类信息:我如何实际从 DHT 中提取 torrent 文件?
问问题
1874 次
2 回答
6
DHT 不提供种子文件。它只是为各个信息散列提供对等列表。Torrent 文件,或者更确切地说是不可变的信息字典,由 bittorrent 群本身提供。
您必须部分实现BEP3、BEP10,最后是 BEP9才能执行元数据交换。此外,实施BEP29和BEP11可以提供改进的连接性,这在检索小群上的元数据时很有用
其次,在不提供任何请求的情况下消耗 DHT 的资源,或反复锤击节点(尤其是引导节点)被认为是不礼貌的。如果您打算获得大量的 torrent 文件,您应该运行一个 DHT 节点作为守护进程,例如通过 Juliusz Chroboczek 的dht lib (C) 或我的(java)。我的实现还包含一个元数据检索服务。libtorrent还应该提供所有必要的部分来实现相同的目标。
于 2016-03-10T06:06:54.217 回答
0
这是一个 base64 编码的 .pcap 文件,显示了实践中的完整通信(注意最后一个数据包)。对其进行解码并在 Wireshark 中打开将向您展示整个过程 - 结合 8472 答案中列出的 BEP,这可以作为示例。
Cg0NCnQAAABNPCsaAQAAAP//////////AwAbAExpbnV4IDQuNy43LTEwMC5mYzIzLng4Nl82NAAEAC
0ARHVtcGNhcCAxLjEyLjIgKEdpdCBSZXYgVW5rbm93biBmcm9tIHVua25vd24pAAAAAAAAAHQAAAAB
AAAASAAAAHEAAAAAAAQAAgADAGFueQAJAAEABgAAAAwAGwBMaW51eCA0LjcuNy0xMDAuZmMyMy54OD
ZfNjQAAAAAAEgAAAAGAAAAbAAAAAAAAABePwUAEVBWkkwAAABMAAAAAAQAAQAGvF/0eXJ3AAAIAEUI
ADwSdEAAQAYV/QoFtU4FT02hviznAcLkEQgAAAAAoAJyEEblAAACBAW0BAIICgAwA3wAAAAAAQMDB2
wAAAAGAAAAbAAAAAAAAABePwUAS9dWkkwAAABMAAAAAAAAAQAGAAFcmVhFAAAIAEXIADwAAEAANgYx
sQVPTaEKBbVO5wG+LJHhxT3C5BEJoBKpsBhCAAACBAW0BAIICowrE6cA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