【发布时间】:2021-01-17 14:01:06
【问题描述】:
我对 DHT 种子索引网站的工作原理很感兴趣。我有使用 nodejs lib 编写的 inhoHashes 刮板。第一次尝试在NAT后面执行,但效率不高,然后我用公共IP去BSD服务器,事情真的好多了。在有关该主题的许多出版物中,我了解到最好的解决方案是运行多个虚拟 DHT 节点以更快地抓取 infoHash。我有代码可以启动几个使用唯一 NODEID 并在自己的端口上运行的 DHT 节点实例。
我的nodejs代码:
"use strict"
const DHT = require('bittorrent-dht')
const crypto = require('crypto');
let DHTnodeID = []
for(let i = 1; i<=10; i++){
DHTnodeID.push({[i]:crypto.createHash('sha1').update(`myDHTnodeLocal${i}`).digest('hex')}) //Give each node unique hash ID
}
let dhtOpt = {
nodeId: '', // 160-bit DHT node ID (Buffer or hex string, default: randomly generated)
//bootstrap: [], // bootstrap servers (default: router.bittorrent.com:6881, router.utorrent.com:6881, dht.transmissionbt.com:6881)
host: false, // host of local peer, if specified then announces get added to local table (String, disabled by default)
concurrency: 16, // k-rpc option to specify maximum concurrent UDP requests allowed (Number, 16 by default)
//hash: Function, // custom hash function to use (Function, SHA1 by default),
//krpc: krpc(), // optional k-rpc instance
//timeBucketOutdated: 900000, // check buckets every 15min
//maxAge: Infinity // optional setting for announced peers to time out
}
var dhtNodes = []
for(let i = 1; i<=DHTnodeID.length; i++){
dhtOpt.nodeId = DHTnodeID[i-1][String(i)]
dhtNodes.push(new DHT(dhtOpt))
}
let port = 6881 //run 10 DHT nodes
for(let item of dhtNodes){
item.listen(port, listenFce)
item.on('ready', readyFce)
item.on('announce', announceFce)
port++
}
然后我找到了一个大学研究项目,其中有以下陈述:
提高吞吐量最明显的方法是使用多个 DHT 节点而不是一个。在一个 IP 地址上使用多个端口 由于基于 IP 地址的过滤,不被认为是可行的选择 抵御潜在的 DoS 攻击。相反,索引器旨在运行 在多个主机或多宿主主机上。个别实例 通过共享关系同步他们的索引活动 存储发现的信息散列和当前处理的数据库 每个 .torrent 文件的阶段。
作者:Aaron Grunthal - 埃斯林根应用科技大学
如果上述陈述属实,是否意味着我的 10 个节点 DHT 实例将被视为 DoS 攻击,我是否会受到某种惩罚?如果这是真的,那么那些网站(DHT torrent indexing site)如何处理这个问题?有没有可能在一台服务器上使用一个公共 IP 运行高效的 infoHash 刮板?显然,我执行的实例越多,我得到的哈希值就越多,但上面的语句让我担心。 非常感谢您。
【问题讨论】:
标签: node.js bittorrent dht torrent webtorrent