anacrolix / torrent

Full-featured BitTorrent client package and utilities
Mozilla Public License 2.0
5.41k stars 617 forks source link

Creating and seeding a torrent #804

Closed kendrickjung closed 1 year ago

kendrickjung commented 1 year ago

I am trying to create a torrent magnet and seed it. The code below allows me to get a torrent magnet, yet, if I use this magnet I can not download anything not even the metainfo. Am I missing something here?

https://gist.github.com/kendrickjung/0e00c7732b2d882d9f7aa8d699088f05

I excepted to have a magnet I can use to download the torrent files somewhere else. Yet the code just waits doing nothing. I think that here AddMagnet is not appropriate as it was designed to load an existing torrent

anacrolix commented 1 year ago

Yeah if you add a torrent by magnet link to a Client, it assumes that's because you don't have the info available, which is why it would fail to seed. Add the entire metainfo, and ensure the data/storage points to the data you used to generate it. Maybe check the example for ./cmd/torrent serve, which you can also run with the provided torrent cmd.

kendrickjung commented 1 year ago

Thank for the answer provided I corrected my code and did work just like you suggested.

Thanks again.

anacrolix commented 1 year ago

No worries!