我目前正在尝试在nodeJS中实现一个最小的洪流客户端。连接到洪流跟踪器/同行
我读通过这个规格:https://wiki.theory.org/index.php/BitTorrentSpecification
我有2点磁铁的URI:
magnet:?xt=urn:btih:633ab5b0cc27218bca2f9fec9b68ae4f7cbf0c5f&dn=dmb2017-05-31.dpa4021.flac16
xt=urn:btih:633ab5b0cc27218bca2f9fec9b68ae4f7cbf0c5f
dn=dmb2017-05-31.dpa4021.flac16
magnet:?xt=urn:btih:9f9165d9a281a9b8e782cd5176bbcc8256fd1871&dn=Ubuntu+16.04.1+LTS+Desktop+64-bit&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Fzer0day.ch%3A1337&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969
xt=urn:btih:9f9165d9a281a9b8e782cd5176bbcc8256fd1871
dn=Ubuntu+16.04.1+LTS+Desktop+64-bit
tr=udp://tracker.leechers-paradise.org:6969
tr=udp://zer0day.ch:1337
tr=udp://open.demonii.com:1337
tr=udp://tracker.coppersurfer.tk:6969
tr=udp://exodus.desync.com:6969
从我读过,跟踪器是用来找到同行,从中下载数据。那么如何下载第一个洪流呢?它没有跟踪器。
我该如何确实进行此连接?
该规范在磁链接上没有任何内容,并指出跟踪器可以通过HTTP(S)协议使用,但这些都明显是UDP。
我给这个刺:
var PORT = 6969 ;
var HOST = 'tracker.leechers-paradise.org';
var dgram = require('dgram');
var message = new Buffer("xt=urn:btih:9f9165d9a281a9b8e782cd5176bbcc8256fd1871");
var client = dgram.createSocket('udp4');
client.on('listening', function() {
var address = client.address();
console.log('UDP Server listening on ' + address.address + ":" + address.port);
});
client.on('message', function (message, remote) {
console.log(remote.address + ':' + remote.port +' - ' + message);
});
client.send(message, 0, message.length, PORT, HOST, function(err, bytes) {
if (err) throw err;
console.log('UDP message sent to ' + HOST +':'+ PORT);
console.log(bytes);
});
显然,这是不行的,但我无法找到任何文件,以帮助。
那么,还有HTTP跟踪器吗?这很酷,我可以使用浏览器客户端。感谢您的额外信息! – Tobiq
是否有单个DHT?我在哪里连接?这一切都令人困惑 – Tobiq
公共HTTP跟踪器在受欢迎时往往会死亡,因为与UDP跟踪器相比,HTTP跟踪器占用的资源要多得多。无论如何,你可以在这里找到一个列表:https://github.com/ngosang/trackerslist只有浏览器的bittorrent客户端是不可能的,因为你需要通过原始TCP或uTP/UDP连接到其他对等端。webtorrent假装是一个真正的bittorrent客户端,但它不是,因为它不能连接到任何以前存在的客户端。 – Encombe