remove Connection module, vector as dependencies, and re-add x509/x509-store

This commit is contained in:
Vincent Hanquez 2014-01-25 16:56:16 +00:00
parent 8985ae49cd
commit a880d4081e
4 changed files with 3 additions and 52 deletions

View file

@ -57,7 +57,7 @@ Executable tls-retrievecertificate
, cprng-aes >= 0.5.0
, x509
, x509-system >= 1.4
, x509-validation >= 1.4
, x509-validation >= 1.5.0
, tls >= 1.2 && < 1.3
, tls-extra >= 0.7 && < 0.8
Buildable: True

View file

@ -9,12 +9,9 @@ module Network.TLS.Extra
(
-- * Cipher related definition
module Network.TLS.Extra.Cipher
-- * Connection helpers
, module Network.TLS.Extra.Connection
-- * File helpers
, module Network.TLS.Extra.File
) where
import Network.TLS.Extra.Cipher
import Network.TLS.Extra.Connection
import Network.TLS.Extra.File

View file

@ -1,46 +0,0 @@
-- |
-- Module : Network.TLS.Extra.Connection
-- License : BSD-style
-- Maintainer : Vincent Hanquez <vincent@snarc.org>
-- Stability : experimental
-- Portability : unknown
--
module Network.TLS.Extra.Connection
( connectionClient
) where
import Crypto.Random.API
import Control.Applicative ((<$>))
import Control.Exception
import Data.Char
import System.IO
import Network.BSD
import Network.Socket
import Network.TLS
-- | @connectionClient host port param rng@ opens a TCP client connection
-- to a destination host and port description (number or name). For
-- example:
--
-- @
-- import Network.TLS.Extra
-- import Crypto.Random.AESCtr
-- ...
-- conn <- makeSystem >>= connectionClient 192.168.2.2 7777 defaultParams
-- @
--
-- will make a new RNG (using cprng-aes) and connect to IP 192.168.2.2
-- on port 7777.
connectionClient :: CPRG g => String -> String -> Params -> g -> IO Context
connectionClient s p params rng = do
pn <- if and $ map isDigit $ p
then return $ fromIntegral $ (read p :: Int)
else servicePort <$> getServiceByName p "tcp"
he <- getHostByName s
h <- bracketOnError (socket AF_INET Stream defaultProtocol) sClose $ \sock -> do
connect sock (SockAddrInet pn (head $ hostAddresses he))
socketToHandle sock ReadWriteMode
contextNewOnHandle h params rng

View file

@ -25,7 +25,8 @@ Library
, network >= 2.3
, cryptohash >= 0.6
, bytestring
, vector
, x509
, x509-store
, cipher-rc4
, cipher-aes >= 0.2 && < 0.3
, crypto-pubkey >= 0.2.0
@ -35,7 +36,6 @@ Library
Exposed-modules: Network.TLS.Extra
other-modules: Network.TLS.Extra.Cipher
Network.TLS.Extra.Compression
Network.TLS.Extra.Connection
Network.TLS.Extra.File
ghc-options: -Wall -fno-warn-missing-signatures
if os(windows)