irc-conduit 0.2.0.0 → 0.2.1.0
raw patch · 2 files changed
+53/−26 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Network.IRC.Conduit: defaultTLSConfig :: Int -> ByteString -> TLSClientConfig
+ Network.IRC.Conduit: ircTLSClient' :: TLSClientConfig -> IO () -> Consumer (Either ByteString IrcEvent) IO () -> Producer IO IrcMessage -> IO ()
Files
- Network/IRC/Conduit.hs +51/−24
- irc-conduit.cabal +2/−2
Network/IRC/Conduit.hs view
@@ -44,8 +44,11 @@ -- *Networking , ircClient- , ircTLSClient , ircWithConn+ -- ** TLS+ , ircTLSClient+ , ircTLSClient'+ , defaultTLSConfig -- *Utilities , rawMessage@@ -141,29 +144,6 @@ -> IO () ircClient port host = ircWithConn $ runTCPClient $ clientSettings port host --- |Like 'ircClient', but with TLS.-ircTLSClient :: Int -> ByteString -> IO () -> Consumer (Either ByteString IrcEvent) IO () -> Producer IO IrcMessage -> IO ()-ircTLSClient port host = ircWithConn $ runTLSClient $ mangle $ tlsClientConfig port host- where- -- Override the certificate validation and allowed ciphers.- mangle tlsSettings = tlsSettings- { tlsClientTLSSettings = TLSSettings cpara- { clientHooks = (clientHooks cpara)- { onServerCertificate = validate }- , clientSupported = (clientSupported cpara)- { supportedVersions = [TLS12, TLS11, TLS10]- , supportedCiphers = ciphersuite_all }}}- where- cpara = defaultParamsClient (unpack $ decodeUtf8 host) ""-- -- Make the TLS certificate validation a bit more generous. In- -- particular, allow self-signed certificates.- validate cs vc sid cc = do- -- First validate with the standard function- res <- (onServerCertificate $ clientHooks cpara) cs vc sid cc- -- Then strip out non-issues- return $ filter (`notElem` [UnknownCA, SelfSigned]) res- -- |Run the IRC conduits using a provided connection. -- -- Starts the connection and concurrently run the initialiser, event@@ -179,3 +159,50 @@ Concurrently start *> Concurrently (appSource appdata =$= exceptionalConduit $$ ircDecoder =$ cons) *> Concurrently (prod $$ ircEncoder =$ appSink appdata)++-- **TLS++-- |Like 'ircClient', but with TLS. The TLS configuration used is+-- 'defaultTLSConfig'.+ircTLSClient :: Int+ -> ByteString+ -> IO ()+ -> Consumer (Either ByteString IrcEvent) IO ()+ -> Producer IO IrcMessage -> IO ()+ircTLSClient port host = ircTLSClient' (defaultTLSConfig port host)++-- |Like 'ircTLSClient', but takes the configuration to use, which+-- includes the host and port.+ircTLSClient' :: TLSClientConfig+ -> IO ()+ -> Consumer (Either ByteString IrcEvent) IO ()+ -> Producer IO IrcMessage -> IO ()+ircTLSClient' cfg = ircWithConn (runTLSClient cfg)++-- |The default TLS settings for 'ircTLSClient'.+defaultTLSConfig :: Int+ -- ^The port number+ -> ByteString+ -- ^ The hostname+ -> TLSClientConfig+defaultTLSConfig port host = (tlsClientConfig port host)+ { tlsClientTLSSettings = TLSSettings cpara+ { clientHooks = (clientHooks cpara)+ { onServerCertificate = validate }+ , clientSupported = (clientSupported cpara)+ { supportedVersions = [TLS12, TLS11, TLS10]+ , supportedCiphers = ciphersuite_all+ }+ }+ }++ where+ cpara = defaultParamsClient (unpack $ decodeUtf8 host) ""++ -- Make the TLS certificate validation a bit more generous. In+ -- particular, allow self-signed certificates.+ validate cs vc sid cc = do+ -- First validate with the standard function+ res <- (onServerCertificate $ clientHooks cpara) cs vc sid cc+ -- Then strip out non-issues+ return $ filter (`notElem` [UnknownCA, SelfSigned]) res
irc-conduit.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.2.0.0+version: 0.2.1.0 -- A short (one-line) description of the package. synopsis: Streaming IRC message library using conduits.@@ -108,4 +108,4 @@ source-repository this type: git location: https://github.com/barrucadu/irc-conduit.git- tag: 0.2.0.0+ tag: 0.2.1.0