summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/GetTorrent.hs5
-rw-r--r--examples/MkTorrent.hs2
2 files changed, 2 insertions, 5 deletions
diff --git a/examples/GetTorrent.hs b/examples/GetTorrent.hs
index 5e624fa1..db52263d 100644
--- a/examples/GetTorrent.hs
+++ b/examples/GetTorrent.hs
@@ -52,9 +52,6 @@ programInfo = info (helper <*> paramsParser)
52 <> header "gettorrent - get torrent file by infohash" 52 <> header "gettorrent - get torrent file by infohash"
53 ) 53 )
54 54
55fakeTracker :: URI
56fakeTracker = fromJust $ parseURI "http://foo.org"
57
58exchangeTorrent :: PeerAddr IP -> InfoHash -> IO InfoDict 55exchangeTorrent :: PeerAddr IP -> InfoHash -> IO InfoDict
59exchangeTorrent addr ih = do 56exchangeTorrent addr ih = do
60 pid <- genPeerId 57 pid <- genPeerId
@@ -72,7 +69,7 @@ getTorrent Params {..} = do
72 DHT.lookup topic $$ C.mapM_ $ \ peers -> do 69 DHT.lookup topic $$ C.mapM_ $ \ peers -> do
73 liftIO $ forM_ peers $ \ peer -> do 70 liftIO $ forM_ peers $ \ peer -> do
74 infodict <- exchangeTorrent (IPv4 <$> peer) topic 71 infodict <- exchangeTorrent (IPv4 <$> peer) topic
75 let torrent = nullTorrent fakeTracker infodict 72 let torrent = nullTorrent infodict -- TODO add tNodes, tCreated, etc?
76 toFile (show topic <.> torrentExt) torrent 73 toFile (show topic <.> torrentExt) torrent
77 exitSuccess 74 exitSuccess
78 75
diff --git a/examples/MkTorrent.hs b/examples/MkTorrent.hs
index 9eda3a52..7bf8b513 100644
--- a/examples/MkTorrent.hs
+++ b/examples/MkTorrent.hs
@@ -122,7 +122,7 @@ amendInfo = info (helper <*> parser) modifier
122type Amend = Torrent -> Torrent 122type Amend = Torrent -> Torrent
123 123
124fields :: [(Text, IO Amend)] 124fields :: [(Text, IO Amend)]
125fields = [ ("announce", set announce <$> askURI) 125fields = [ ("announce", set announce . Just <$> askURI)
126 , ("comment", set comment . Just <$> askFreeform) 126 , ("comment", set comment . Just <$> askFreeform)
127 , ("created by", set createdBy . Just <$> askFreeform) 127 , ("created by", set createdBy . Just <$> askFreeform)
128 , ("publisher url", set publisherURL . Just <$> askURI) 128 , ("publisher url", set publisherURL . Just <$> askURI)