crypton-connection 0.4.1 → 0.4.2
raw patch · 5 files changed
+55/−34 lines, 5 filesdep +data-defaultdep −data-default-classsetup-changedPVP ok
version bump matches the API change (PVP)
Dependencies added: data-default
Dependencies removed: data-default-class
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- Network/Connection.hs +1/−1
- Network/Connection/Types.hs +45/−29
- Setup.hs +1/−0
- crypton-connection.cabal +4/−4
CHANGELOG.md view
@@ -1,5 +1,9 @@ # CHANGELOG +## Version 0.4.2++* Using data-default.+ ## Version 0.4.1 * Preparing for tls v2.1
Network/Connection.hs view
@@ -65,7 +65,7 @@ import qualified Network.Socket.ByteString as N import Data.Tuple (swap)-import Data.Default.Class+import Data.Default import Data.Data import Data.ByteString (ByteString) import qualified Data.ByteString as B
Network/Connection/Types.hs view
@@ -6,15 +6,14 @@ -- Portability : portable -- -- connection types--- module Network.Connection.Types- where+where import Control.Concurrent.MVar (MVar) -import Data.Default.Class-import Data.X509.CertificateStore import Data.ByteString (ByteString)+import Data.Default+import Data.X509.CertificateStore import Network.Socket (PortNumber, Socket) import qualified Network.TLS as TLS@@ -23,10 +22,10 @@ import System.IO (Handle) -- | Simple backend enumeration, either using a raw connection or a tls connection.-data ConnectionBackend = ConnectionStream Handle- | ConnectionSocket Socket- | ConnectionTLS TLS.Context-+data ConnectionBackend+ = ConnectionStream Handle+ | ConnectionSocket Socket+ | ConnectionTLS TLS.Context -- | Hostname This could either be a name string (punycode encoded) or an ipv4/ipv6 type HostName = String@@ -41,10 +40,14 @@ -- If you need to connect through a SOCKS, you should make sure -- connectionUseSocks is correctly set. data ConnectionParams = ConnectionParams- { connectionHostname :: HostName -- ^ host name to connect to.- , connectionPort :: PortNumber -- ^ port number to connect to.- , connectionUseSecure :: Maybe TLSSettings -- ^ optional TLS parameters.- , connectionUseSocks :: Maybe ProxySettings -- ^ optional Proxy/Socks configuration.+ { connectionHostname :: HostName+ -- ^ host name to connect to.+ , connectionPort :: PortNumber+ -- ^ port number to connect to.+ , connectionUseSecure :: Maybe TLSSettings+ -- ^ optional TLS parameters.+ , connectionUseSocks :: Maybe ProxySettings+ -- ^ optional Proxy/Socks configuration. } -- | Proxy settings for the connection.@@ -55,8 +58,8 @@ -- -- That's for now the only settings in the SOCKS package, -- socks password, or any sort of other authentications is not yet implemented.-data ProxySettings =- SockSettingsSimple HostName PortNumber+data ProxySettings+ = SockSettingsSimple HostName PortNumber | SockSettingsEnvironment (Maybe String) | OtherProxy HostName PortNumber @@ -69,30 +72,43 @@ -- simple settings, you should use TLSSettingsSimple. data TLSSettings = TLSSettingsSimple- { settingDisableCertificateValidation :: Bool -- ^ Disable certificate verification completely,- -- this make TLS/SSL vulnerable to a MITM attack.- -- not recommended to use, but for testing.- , settingDisableSession :: Bool -- ^ Disable session management. TLS/SSL connections- -- will always re-established their context.- -- Not Implemented Yet.- , settingUseServerName :: Bool -- ^ Use server name extension. Not Implemented Yet.- , settingClientSupported :: TLS.Supported- -- ^ Used for the 'TLS.clientSupported'- -- member of 'TLS.ClientParams'.- } -- ^ Simple TLS settings. recommended to use.- | TLSSettings TLS.ClientParams -- ^ full blown TLS Settings directly using TLS.Params. for power users.+ { settingDisableCertificateValidation :: Bool+ -- ^ Disable certificate verification completely,+ -- this make TLS/SSL vulnerable to a MITM attack.+ -- not recommended to use, but for testing.+ , settingDisableSession :: Bool+ -- ^ Disable session management. TLS/SSL connections+ -- will always re-established their context.+ -- Not Implemented Yet.+ , settingUseServerName :: Bool+ -- ^ Use server name extension. Not Implemented Yet.+ , settingClientSupported :: TLS.Supported+ -- ^ Used for the 'TLS.clientSupported'+ -- member of 'TLS.ClientParams'.+ }+ | -- \^ Simple TLS settings. recommended to use.++ -- | full blown TLS Settings directly using TLS.Params. for power users.+ TLSSettings TLS.ClientParams deriving (Show) instance Default TLSSettings where- def = TLSSettingsSimple False False False def { TLS.supportedCiphers = TLS.ciphersuite_default }+ def =+ TLSSettingsSimple+ False+ False+ False+ def{TLS.supportedCiphers = TLS.ciphersuite_default} type ConnectionID = (HostName, PortNumber) -- | This opaque type represent a connection to a destination. data Connection = Connection { connectionBackend :: MVar ConnectionBackend- , connectionBuffer :: MVar (Maybe ByteString) -- ^ this is set to 'Nothing' on EOF- , connectionID :: ConnectionID -- ^ return a simple tuple of the port and hostname that we're connected to.+ , connectionBuffer :: MVar (Maybe ByteString)+ -- ^ this is set to 'Nothing' on EOF+ , connectionID :: ConnectionID+ -- ^ return a simple tuple of the port and hostname that we're connected to. } -- | Shared values (certificate store, sessions, ..) between connections
Setup.hs view
@@ -1,2 +1,3 @@ import Distribution.Simple+ main = defaultMain
crypton-connection.cabal view
@@ -1,7 +1,7 @@ Name: crypton-connection-Version: 0.4.1+Version: 0.4.2 Description:- Simple network library for all your connection need.+ Simple network library for all your connection needs. . Features: Really simple to use, SSL/TLS, SOCKS. .@@ -12,7 +12,7 @@ Copyright: Vincent Hanquez <vincent@snarc.org> Author: Vincent Hanquez <vincent@snarc.org> Maintainer: Kazu Yamamoto <kazu@iij.ad.jp>-Synopsis: Simple and easy network connections API+Synopsis: Simple and easy network connection API Build-Type: Simple Category: Network stability: experimental@@ -27,7 +27,7 @@ , basement , bytestring , containers- , data-default-class+ , data-default , network >= 2.6.3 , tls >= 1.7 && < 2.2 , socks >= 0.6