packages feed

network-anonymous-i2p 0.9.1 → 0.9.2

raw patch · 3 files changed

+21/−19 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

network-anonymous-i2p.cabal view
@@ -1,6 +1,6 @@ name: network-anonymous-i2p
 category: Network
-version: 0.9.1
+version: 0.9.2
 description: Haskell API for I2P anonymous networking
 
 license: MIT
src/Network/Anonymous/I2P.hs view
@@ -46,9 +46,9 @@ -- $i2p-introduction
 --
 -- This module is an implementation of the SAMv3 protocol for I2P. I2P is an
--- internet anonimization network, similar to Tor. Whereas Tor is intended for
--- privately using the internet, I2P is more application oriented, and is intended
--- for private communication between applications.
+-- internet anonimization network, similar to Tor. Whereas Tor is primarily
+-- intended for privately browsing the world wide web, I2P is more application
+-- oriented, and is intended for private communication between applications.
 --
 -- The general idea of the SAM interface to I2P is that you establish a master
 -- connection with the SAM bridge, and create new, short-lived connections with
@@ -85,7 +85,7 @@ --     dest :: 'D.PublicDestination'
 --     dest = undefined
 --
---     withinSession -> 'S.Context' -> IO ()
+--     withinSession :: 'S.Context' -> IO ()
 --     withinSession ctx = connectStream ctx dest worker
 --
 --     worker (sock, addr) = do
@@ -105,7 +105,7 @@ --     dest :: 'D.PublicDestination'
 --     dest = undefined
 --
---     withinSession -> 'S.Context' -> IO ()
+--     withinSession :: 'S.Context' -> IO ()
 --     withinSession ctx = do
 --       sendDatagram ctx dest \"Hello, anonymous world!\"
 --
@@ -126,7 +126,7 @@ --   main = 'withSession' 'S.VirtualStream' withinSession
 --
 --   where
---     withinSession -> 'S.Context' -> IO ()
+--     withinSession :: 'S.Context' -> IO ()
 --     withinSession ctx = serveStream ctx worker
 --
 --     worker (sock, addr) = do
@@ -137,13 +137,13 @@ -- @
 --
 -- == Datagram
--- Receiving a 'S.DatagramAnonymous' messages from remotes:
+-- Receiving 'S.DatagramAnonymous' messages from remotes:
 --
 -- @
 --   main = 'withSession' 'S.DatagramAnonymous' withinSession
 --
 --   where
---     withinSession -> 'S.Context' -> IO ()
+--     withinSession :: 'S.Context' -> IO ()
 --     withinSession ctx =
 --       serveDatagram ctx worker
 --
src/Network/Anonymous/I2P/Protocol.hs view
@@ -61,19 +61,21 @@                -> (BS.ByteString, BS.ByteString)
                -> m [Ast.Token]
 expectResponse sock output (first, second) = do
-    liftIO $ D.log
-      ("sending to remote: " ++ show output)
-      Network.sendAll sock output
+  liftIO $ D.log
+    ("sending to remote: " ++ show output)
+    Network.sendAll sock output
 
-    res <- NA.parseOne sock (Atto.parse Parser.line)
+  res <- NA.parseOne sock (Atto.parse Parser.line)
 
-    liftIO $ putStrLn ("got response: " ++ show res)
+  D.log
+    ("received response: " ++ show res)
+    return ()
 
-    case res of
-     (Ast.Token first' Nothing : Ast.Token second' Nothing : xs) -> if first == first' && second == second'
-                                                                    then return xs
-                                                                    else E.i2pError (E.mkI2PError E.protocolErrorType)
-     _                                                           -> E.i2pError (E.mkI2PError E.protocolErrorType)
+  case res of
+   (Ast.Token first' Nothing : Ast.Token second' Nothing : xs) -> if first == first' && second == second'
+                                                                  then return xs
+                                                                  else E.i2pError (E.mkI2PError E.protocolErrorType)
+   _                                                           -> E.i2pError (E.mkI2PError E.protocolErrorType)
 
 -- | Announces ourselves with SAM bridge and negotiates protocol version
 --