]> git.rkrishnan.org Git - functorrent.git/blob - src/FuncTorrent/MagnetURI.hs
MagnetURI: New module to handle magnet uris
[functorrent.git] / src / FuncTorrent / MagnetURI.hs
1 {-
2 Copyright (C) 2015-2016 Ramakrishnan Muthukrishnan <ram@rkrishnan.org>
3
4 This file is part of FuncTorrent.
5
6 FuncTorrent is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 FuncTorrent is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with FuncTorrent; if not,  see <http://www.gnu.org/licenses/>
18 -}
19
20 -- | Parse magnet URI
21 -- The spec for magnetURI: https://en.wikipedia.org/wiki/Magnet_URI_scheme
22 -- An example from tpb:
23 --   magnet:?xt=urn:btih:1f8a4ee3c3f57e81f8f0b4e658177201fc2a3118&dn=Honey+Bee+2+%5B2017%5D+Malayalam+DVDRiP+x264+AAC+700MB+ZippyMovieZ+E&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
24 -- xt   - extra topic - urn containing filehash
25 -- btih - bittorrent infohash
26 -- dn   - display name (for the user)
27 -- tr   - tracker URL
28 -- xl   - exact length
29 -- mt   - link to a meta file (manifest topic) that contains a list of magnet links
30 -- urn  - uniform resource name
31
32 -- How does a client join the swarm with only the magnet uri?
33 -- This is detailed in http://www.bittorrent.org/beps/bep_0009.html
34 -- The protocol depends on the extensions protocol specified in BEP 0010.
35 -- http://www.bittorrent.org/beps/bep_0009.html
36
37 -- 1. First we parse the magnet uri and get a list of trackers
38 -- 2. We then use the usual tracker protocol to get a list of peers.
39 -- 3. Then we talk to the peers to create the metadata via the BEP 0009 protocol
40
41 module FuncTorrent.MagnetURI where
42
43