bittorrent-0.0.0.3: Bittorrent protocol implementation.

Portabilityportable
Stabilityexperimental
Maintainerpxqr.sta@gmail.com
Safe HaskellNone

Data.Torrent.Magnet

Contents

Description

Parsing and rendering of magnet URIs.

For more info see: http://magnet-uri.sourceforge.net/magnet-draft-overview.txt

Bittorrent specific info: http://www.bittorrent.org/beps/bep_0009.html

Synopsis

Magnet

data Magnet Source

An URI used to identify torrent.

Constructors

Magnet 

Fields

exactTopic :: !InfoHash

Resource hash.

displayName :: Maybe Text

Might be used to display name while waiting for metadata.

exactLength :: Maybe Integer

Size of the resource in bytes.

manifest :: Maybe String
 
keywordTopic :: Maybe String

Search string.

acceptableSource :: Maybe URI
 
exactSource :: Maybe URI
 
tracker :: Maybe URI
 
supplement :: Map Text Text
 

Instances

Construction

nullMagnet :: InfoHash -> MagnetSource

Set exact topic only, other params are empty.

simpleMagnet :: Torrent -> MagnetSource

A simple magnet link including infohash (xt param) and display name (dn param).

detailedMagnet :: Torrent -> MagnetSource

Like simpleMagnet but also include exactLength (xl param) and tracker (tr param).

Conversion

parseMagnet :: String -> Maybe MagnetSource

Try to parse magnet link from urlencoded string.

renderMagnet :: Magnet -> StringSource

Render magnet link to urlencoded string

Extra

fromURI :: URI -> Either String MagnetSource

The same as parseMagnet but useful if you alread have a parsed uri.

toURI :: Magnet -> URISource

The same as renderMagnet but useful if you need an uri.