maximwebb / torrensic

Lightweight torrent client written in Rust
1 stars 0 forks source link

Add support for magnet links #9

Open maximwebb opened 1 year ago

maximwebb commented 1 year ago

Magnet links contain less info than .torrent files, so we need to decouple the info we would normally get from a file:

This now gives us the following process:

                       +---------------------------+                   
                       | If from file, we already  |                   
                       | have FileInfo, so just    | ----------------¬ 
                       | req PeerInfo from tracker |                  \     
                       +---------------------------+                   \    
                                /                                       \
+---------------------------+ /                                          \ +-----------------+
|     Parse TrackerInfo     |                                              | Start peer wire |
|   from file/magnet link   |                                            / |    protocol     |
+---------------------------+ \                                         /  +-----------------+
                                \                                      /
                       +----------------------+        +---------------+
                       |  If from magnet, get | -----> | Get PeerInfo  |
                       |  FileInfo using DHT  |        |    from DHT   |
                       +----------------------+        +---------------+

http://www.bittorrent.org/beps/bep_0005.html

maximwebb commented 1 week ago