Ai
1 Star 0 Fork 0

newbeenoob/nodejs-torrent

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
app.js 690 Bytes
一键复制 编辑 原始数据 按行查看 历史
newbeenoob 提交于 2022-03-25 14:45 +08:00 . add tracker.js
'use strict';
const fs = require('fs');
const bencode = require('bencode');
const tracker = require('./utils/tracker');
const torrent = bencode.decode(fs.readFileSync('./torrents/test.torrent'));
const announceList = torrent['announce-list'];
for (let announces of announceList){
let announce = announces[0]
let rawUrl = announce.toString('utf-8');
// 目前只能处理基于udp的tracker
if(rawUrl.startsWith('udp')){
tracker.getPeersList(rawUrl , peers => {
console.log(peers);
})
}
// udp://tracker.opentrackr.org:1337/announce
// udp://tracker.torrent.eu.org:451/announce
// udp://tracker.zerobytes.xyz:1337/announce
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/aaaandrews/nodejs-torrent.git
git@gitee.com:aaaandrews/nodejs-torrent.git
aaaandrews
nodejs-torrent
nodejs-torrent
master

搜索帮助