真正下载数据的部分在github.com/anacrolix/torrent

问题描述 投票:0回答:1

最近,我一直在使用这个项目(github.com/anacrolix/torrent)。具体来说,它是一个图书馆。我使用其中的 cmd/torrent 模块来了解这个库的工作原理。

命令是这样的:

cd cmd/torrent
go mod init torrentmain
go mod tidy
go build
./torrentmain download The.Mandalorian.S03E06.WEB.x264-TORRENTGALAXY.torrent

调试时遇到一些问题。

download.go/downloadErr 函数调用 addTorrents 函数,该函数通过调用 t.DownloadAll() 标记要下载的整个 torrent。

由于 t.DownloadAll() 只是宣布应该下载哪些片段,实际的下载工作是由一些 goroutines 完成的(我猜),我不知道它是如何工作的。

我想知道的是它在哪个子模块下载数据以及如何下载数据。

我的最终目的是让下载的文件直接保存在内存中,而不是存储在磁盘中。所以我需要知道它在哪个子模块中下载数据以及如何下载数据。

p2p torrent
1个回答
0
投票

这个问题已在 https://github.com/anacrolix/torrent/issues/829中解决。

© www.soinside.com 2019 - 2024. All rights reserved.