summaryrefslogtreecommitdiff
path: root/src/Network/Tox
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2018-06-22 21:17:22 -0400
committerjoe <joe@jerkface.net>2018-06-22 21:17:22 -0400
commitf5f854c8144dc29086928a94b2ea86cfae0d0557 (patch)
tree5a7daccc1be66375edd35b238f348129f540b146 /src/Network/Tox
parent6f040764654640730d3f832cf4e41174562718fb (diff)
Removed redundant imports and other clean up.
Diffstat (limited to 'src/Network/Tox')
-rw-r--r--src/Network/Tox/Avahi.hs2
-rw-r--r--src/Network/Tox/ContactInfo.hs4
-rw-r--r--src/Network/Tox/Crypto/Handlers.hs10
-rw-r--r--src/Network/Tox/DHT/Handlers.hs7
-rw-r--r--src/Network/Tox/DHT/Transport.hs6
-rw-r--r--src/Network/Tox/NodeId.hs2
-rw-r--r--src/Network/Tox/Onion/Handlers.hs16
-rw-r--r--src/Network/Tox/Onion/Transport.hs3
-rw-r--r--src/Network/Tox/Transport.hs1
9 files changed, 2 insertions, 49 deletions
diff --git a/src/Network/Tox/Avahi.hs b/src/Network/Tox/Avahi.hs
index ed52de74..7fe87db2 100644
--- a/src/Network/Tox/Avahi.hs
+++ b/src/Network/Tox/Avahi.hs
@@ -7,10 +7,8 @@ module Network.Tox.Avahi
7 ) where 7 ) where
8 8
9import Data.Foldable 9import Data.Foldable
10import GHC.Word (Word16)
11import Network.Address 10import Network.Address
12import Network.Avahi 11import Network.Avahi
13import Network.Socket
14import Network.Tox.NodeId 12import Network.Tox.NodeId
15import Text.Read 13import Text.Read
16 14
diff --git a/src/Network/Tox/ContactInfo.hs b/src/Network/Tox/ContactInfo.hs
index e76e2f1b..3f794197 100644
--- a/src/Network/Tox/ContactInfo.hs
+++ b/src/Network/Tox/ContactInfo.hs
@@ -1,7 +1,6 @@
1{-# LANGUAGE NamedFieldPuns #-} 1{-# LANGUAGE NamedFieldPuns #-}
2module Network.Tox.ContactInfo where 2module Network.Tox.ContactInfo where
3 3
4import ConnectionKey
5import Connection 4import Connection
6 5
7import Data.Time.Clock.POSIX 6import Data.Time.Clock.POSIX
@@ -11,13 +10,10 @@ import Crypto.PubKey.Curve25519
11import qualified Data.HashMap.Strict as HashMap 10import qualified Data.HashMap.Strict as HashMap
12 ;import Data.HashMap.Strict (HashMap) 11 ;import Data.HashMap.Strict (HashMap)
13import Data.Maybe 12import Data.Maybe
14import qualified Data.Set as Set
15 ;import Data.Set (Set)
16import Network.Socket 13import Network.Socket
17import Network.Tox.DHT.Transport as DHT 14import Network.Tox.DHT.Transport as DHT
18import Network.Tox.NodeId (id2key) 15import Network.Tox.NodeId (id2key)
19import Network.Tox.Onion.Transport as Onion 16import Network.Tox.Onion.Transport as Onion
20import System.IO
21import DPut 17import DPut
22 18
23newtype ContactInfo extra = ContactInfo 19newtype ContactInfo extra = ContactInfo
diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs
index 73e5f686..282a7dce 100644
--- a/src/Network/Tox/Crypto/Handlers.hs
+++ b/src/Network/Tox/Crypto/Handlers.hs
@@ -9,20 +9,16 @@ module Network.Tox.Crypto.Handlers where
9 9
10import Network.Tox.NodeId 10import Network.Tox.NodeId
11import Network.Tox.Crypto.Transport 11import Network.Tox.Crypto.Transport
12import Network.Tox.DHT.Transport (Cookie(..),CookieData(..), CookieRequest(..), NoSpam(..)) 12import Network.Tox.DHT.Transport (Cookie(..), NoSpam(..))
13import Network.Tox.DHT.Handlers (Client, cookieRequest, createCookieSTM )
14import Crypto.Tox 13import Crypto.Tox
15import Control.Arrow 14import Control.Arrow
16import Control.Concurrent.STM 15import Control.Concurrent.STM
17import Control.Concurrent.STM.TMChan 16import Control.Concurrent.STM.TMChan
18import Network.Address 17import Network.Address
19import qualified Data.Map.Strict as Map 18import qualified Data.Map.Strict as Map
20import Crypto.Hash
21import Control.Applicative
22import Control.Monad 19import Control.Monad
23import Data.Time.Clock.POSIX 20import Data.Time.Clock.POSIX
24import qualified Data.ByteString as B 21import qualified Data.ByteString as B
25import System.IO
26import Data.ByteString (ByteString) 22import Data.ByteString (ByteString)
27import Control.Lens 23import Control.Lens
28import Data.Function 24import Data.Function
@@ -39,10 +35,8 @@ import qualified Data.Set as Set
39import qualified Data.Array.Unboxed as A 35import qualified Data.Array.Unboxed as A
40import SensibleDir 36import SensibleDir
41import System.FilePath 37import System.FilePath
42import System.IO.Temp
43import System.Environment 38import System.Environment
44import System.Directory 39import System.Directory
45import System.Random -- for ping fuzz
46#ifdef THREAD_DEBUG 40#ifdef THREAD_DEBUG
47import Control.Concurrent.Lifted.Instrument 41import Control.Concurrent.Lifted.Instrument
48#else 42#else
@@ -54,11 +48,9 @@ import qualified Data.IntMap.Strict as IntMap
54import Control.Concurrent.Supply 48import Control.Concurrent.Supply
55import Data.InOrOut 49import Data.InOrOut
56import DPut 50import DPut
57import Debug.Trace
58import Text.Printf 51import Text.Printf
59import Data.Bool 52import Data.Bool
60import Connection (Status(..), Policy(..)) 53import Connection (Status(..), Policy(..))
61import Network.Tox.ContactInfo
62import Network.Tox.Handshake 54import Network.Tox.Handshake
63 55
64-- | This type indicates the progress of a tox encrypted friend link 56-- | This type indicates the progress of a tox encrypted friend link
diff --git a/src/Network/Tox/DHT/Handlers.hs b/src/Network/Tox/DHT/Handlers.hs
index 6c29e958..09d6f66b 100644
--- a/src/Network/Tox/DHT/Handlers.hs
+++ b/src/Network/Tox/DHT/Handlers.hs
@@ -14,7 +14,7 @@ import Network.Kademlia.Search
14import qualified Data.Wrapper.PSQInt as Int 14import qualified Data.Wrapper.PSQInt as Int
15import Network.Kademlia 15import Network.Kademlia
16import Network.Kademlia.Bootstrap 16import Network.Kademlia.Bootstrap
17import Network.Address (WantIP (..), ipFamily, testIdBit,fromSockAddr, sockAddrPort) 17import Network.Address (WantIP (..), ipFamily, fromSockAddr, sockAddrPort)
18import qualified Network.Kademlia.Routing as R 18import qualified Network.Kademlia.Routing as R
19import Control.TriadCommittee 19import Control.TriadCommittee
20import System.Global6 20import System.Global6
@@ -29,7 +29,6 @@ import Control.Concurrent.Lifted.Instrument
29import Control.Concurrent.STM 29import Control.Concurrent.STM
30import Data.Time.Clock.POSIX (POSIXTime, getPOSIXTime) 30import Data.Time.Clock.POSIX (POSIXTime, getPOSIXTime)
31import Network.Socket 31import Network.Socket
32import Data.Hashable
33import qualified Data.HashMap.Strict as HashMap 32import qualified Data.HashMap.Strict as HashMap
34 ;import Data.HashMap.Strict (HashMap) 33 ;import Data.HashMap.Strict (HashMap)
35#if MIN_VERSION_iproute(1,7,4) 34#if MIN_VERSION_iproute(1,7,4)
@@ -37,13 +36,9 @@ import Data.IP hiding (fromSockAddr)
37#else 36#else
38import Data.IP 37import Data.IP
39#endif 38#endif
40import Data.Ord
41import Data.Maybe 39import Data.Maybe
42import Data.Bits
43import Data.Serialize (Serialize) 40import Data.Serialize (Serialize)
44import Data.Word 41import Data.Word
45import Data.List
46import System.IO
47import DPut 42import DPut
48 43
49data TransactionId = TransactionId 44data TransactionId = TransactionId
diff --git a/src/Network/Tox/DHT/Transport.hs b/src/Network/Tox/DHT/Transport.hs
index 9ff1839c..c6fe121c 100644
--- a/src/Network/Tox/DHT/Transport.hs
+++ b/src/Network/Tox/DHT/Transport.hs
@@ -21,7 +21,6 @@ module Network.Tox.DHT.Transport
21 , DHTPublicKey(..) 21 , DHTPublicKey(..)
22 , FriendRequest(..) 22 , FriendRequest(..)
23 , NoSpam(..) 23 , NoSpam(..)
24 , verifyChecksum
25 , CookieRequest(..) 24 , CookieRequest(..)
26 , CookieResponse(..) 25 , CookieResponse(..)
27 , Cookie(..) 26 , Cookie(..)
@@ -45,7 +44,6 @@ import Control.Arrow
45import Control.Concurrent.STM 44import Control.Concurrent.STM
46import Control.Monad 45import Control.Monad
47import Data.Bool 46import Data.Bool
48import qualified Data.ByteString.Char8 as B8
49import qualified Data.ByteString as B 47import qualified Data.ByteString as B
50 ;import Data.ByteString (ByteString) 48 ;import Data.ByteString (ByteString)
51import Data.Functor.Contravariant 49import Data.Functor.Contravariant
@@ -54,11 +52,7 @@ import Data.Monoid
54import Data.Serialize as S 52import Data.Serialize as S
55import Data.Tuple 53import Data.Tuple
56import Data.Word 54import Data.Word
57import Foreign.C (CTime(..))
58import Network.Socket 55import Network.Socket
59import qualified Data.ByteString.Base64 as Base64
60import qualified Data.ByteString.Base16 as Base16
61import Data.Char (isSpace)
62 56
63type DHTTransport = Transport String NodeInfo (DHTMessage Encrypted8) 57type DHTTransport = Transport String NodeInfo (DHTMessage Encrypted8)
64type HandleHi a = Maybe (Either String (DHTMessage Encrypted8, NodeInfo)) -> IO a 58type HandleHi a = Maybe (Either String (DHTMessage Encrypted8, NodeInfo)) -> IO a
diff --git a/src/Network/Tox/NodeId.hs b/src/Network/Tox/NodeId.hs
index 2f836b8e..f9cf22a8 100644
--- a/src/Network/Tox/NodeId.hs
+++ b/src/Network/Tox/NodeId.hs
@@ -35,7 +35,6 @@ module Network.Tox.NodeId
35 , nospam16 35 , nospam16
36 , verifyChecksum) where 36 , verifyChecksum) where
37 37
38import Debug.Trace
39import Control.Applicative 38import Control.Applicative
40import Control.Arrow 39import Control.Arrow
41import Control.Monad 40import Control.Monad
@@ -83,7 +82,6 @@ import System.Endian
83import qualified Data.Text as Text 82import qualified Data.Text as Text
84 ;import Data.Text (Text) 83 ;import Data.Text (Text)
85import Util (splitJID) 84import Util (splitJID)
86import Text.Printf
87 85
88-- | perform io for hashes that do allocation and ffi. 86-- | perform io for hashes that do allocation and ffi.
89-- unsafeDupablePerformIO is used when possible as the 87-- unsafeDupablePerformIO is used when possible as the
diff --git a/src/Network/Tox/Onion/Handlers.hs b/src/Network/Tox/Onion/Handlers.hs
index f497a1bf..80a6ae3a 100644
--- a/src/Network/Tox/Onion/Handlers.hs
+++ b/src/Network/Tox/Onion/Handlers.hs
@@ -12,23 +12,9 @@ import qualified Network.QueryResponse as QR (Client)
12import Crypto.Tox 12import Crypto.Tox
13import qualified Data.Wrapper.PSQ as PSQ 13import qualified Data.Wrapper.PSQ as PSQ
14 ;import Data.Wrapper.PSQ (PSQ,pattern (:->)) 14 ;import Data.Wrapper.PSQ (PSQ,pattern (:->))
15#ifdef CRYPTONITE_BACKPORT
16import Crypto.Error.Types (CryptoFailable (..),
17 throwCryptoError)
18#else
19import Crypto.Error
20#endif
21import Control.Arrow 15import Control.Arrow
22 16
23import System.IO
24import qualified Data.ByteArray as BA
25import Data.Function 17import Data.Function
26import Data.Serialize as S
27import qualified Data.Wrapper.PSQInt as Int
28import Network.Kademlia
29import Network.Address (WantIP (..), ipFamily, testIdBit)
30import qualified Network.Kademlia.Routing as R
31import Control.TriadCommittee
32import qualified Data.MinMaxPSQ as MinMaxPSQ 18import qualified Data.MinMaxPSQ as MinMaxPSQ
33 ;import Data.MinMaxPSQ (MinMaxPSQ') 19 ;import Data.MinMaxPSQ (MinMaxPSQ')
34import Network.BitTorrent.DHT.Token as Token 20import Network.BitTorrent.DHT.Token as Token
@@ -50,8 +36,6 @@ import Data.IP hiding (fromSockAddr)
50import Data.IP 36import Data.IP
51#endif 37#endif
52import Data.Maybe 38import Data.Maybe
53import Data.Bits
54import Data.Ord
55import Data.Functor.Identity 39import Data.Functor.Identity
56import DPut 40import DPut
57 41
diff --git a/src/Network/Tox/Onion/Transport.hs b/src/Network/Tox/Onion/Transport.hs
index 70714465..e2e136ae 100644
--- a/src/Network/Tox/Onion/Transport.hs
+++ b/src/Network/Tox/Onion/Transport.hs
@@ -62,7 +62,6 @@ import Control.Concurrent.STM
62import Control.Monad 62import Control.Monad
63import qualified Data.ByteString as B 63import qualified Data.ByteString as B
64 ;import Data.ByteString (ByteString) 64 ;import Data.ByteString (ByteString)
65import Data.Coerce
66import Data.Function 65import Data.Function
67import Data.Functor.Contravariant 66import Data.Functor.Contravariant
68import Data.Functor.Identity 67import Data.Functor.Identity
@@ -77,11 +76,9 @@ import Data.Serialize as S
77import Data.Type.Equality 76import Data.Type.Equality
78import Data.Typeable 77import Data.Typeable
79import Data.Word 78import Data.Word
80import Debug.Trace
81import GHC.Generics () 79import GHC.Generics ()
82import GHC.TypeLits 80import GHC.TypeLits
83import Network.Socket 81import Network.Socket
84import System.IO
85import qualified Text.ParserCombinators.ReadP as RP 82import qualified Text.ParserCombinators.ReadP as RP
86import Data.Hashable 83import Data.Hashable
87import DPut 84import DPut
diff --git a/src/Network/Tox/Transport.hs b/src/Network/Tox/Transport.hs
index 57f07aad..0b03ed19 100644
--- a/src/Network/Tox/Transport.hs
+++ b/src/Network/Tox/Transport.hs
@@ -8,7 +8,6 @@
8{-# LANGUAGE TypeOperators #-} 8{-# LANGUAGE TypeOperators #-}
9module Network.Tox.Transport (toxTransport, RouteId) where 9module Network.Tox.Transport (toxTransport, RouteId) where
10 10
11import Data.ByteString (ByteString)
12import Network.QueryResponse 11import Network.QueryResponse
13import Crypto.Tox 12import Crypto.Tox
14import Network.Tox.DHT.Transport 13import Network.Tox.DHT.Transport