ClickHaskell-tls (empty) → 1.0.0
raw patch · 5 files changed
+130/−0 lines, 5 filesdep +ClickHaskelldep +basedep +bytestringsetup-changed
Dependencies added: ClickHaskell, base, bytestring, tls
Files
- ChangeLog.md +3/−0
- ClickHaskell-tls.cabal +66/−0
- ClickHaskell/TLS.hs +31/−0
- LICENSE +28/−0
- Setup.hs +2/−0
+ ChangeLog.md view
@@ -0,0 +1,3 @@+# 0.1.0 -- ?++Initial release
+ ClickHaskell-tls.cabal view
@@ -0,0 +1,66 @@+Cabal-version: 3.0+++Name: ClickHaskell-tls+Version: 1.0.0++Author: Kovalev Dmitry+Maintainer: Kovalev Dmitry+Category: ClickHouse+Synopsis: ClickHaskell TLS extension+Description: ClickHaskell library extension with provided TLS support +Tested-with: GHC == 8.10.7, GHC == 9.0.2, GHC == 9.2.8, GHC == 9.4.8, GHC == 9.6.6, GHC == 9.8.4, GHC == 9.10.1+Homepage: https://clickhaskell.dev/+Bug-reports: https://git.clickhaskell.dev/+License: BSD-3-Clause+License-File: LICENSE+Copyright: 2023 Kovalev Dmitry+Build-Type: Simple++extra-doc-files:+ ChangeLog.md++Source-repository head+ Type: git+ Location: https://github.com/KovalevDima/ClickHaskell++Flag dev+ Description: Dumps Core representation+ Default: False+ Manual: True++Library+ Exposed-Modules:+ ClickHaskell.TLS+ HS-Source-Dirs:+ ./+ GHC-Options:+ -Wall+ -Wunused-packages++ Build-depends:+ -- GHC included libraries+ base >= 4.7 && <5+ , bytestring < 1++ -- Internal+ , ClickHaskell ^>= 1.0.0++ -- External dependencies+ , tls < 3++ if flag(dev)+ GHC-Options:+ -ddump-to-file+ -ddump-simpl+ -ddump-spec+ -ddump-simpl-stats+ -ddump-rule-firings+ -dsuppress-all+ -dsuppress-uniques++ default-language: Haskell2010+ default-extensions:+ NamedFieldPuns+ RecordWildCards+ OverloadedStrings
+ ClickHaskell/TLS.hs view
@@ -0,0 +1,31 @@+{-# LANGUAGE NumericUnderscores #-}+{-# LANGUAGE TypeApplications #-}+module ClickHaskell.TLS where++-- Internal+import ClickHaskell (ConnectionArgs, overrideInitConnection, overrideDefaultPort, BufferArgs(..))++-- GHC included+import Data.ByteString.Builder (toLazyByteString)++-- External+import Network.TLS (ClientParams (..), contextClose, contextNew, defaultParamsClient, handshake, recvData, sendData)++{-|+ Sets TLS connection++ Uses 9443 port by default. Watch 'setPort' to override it+-}+setSecure :: (ClientParams -> ClientParams) -> ConnectionArgs -> ConnectionArgs+setSecure modifyParams = overrideDefaultPort "9443" . overrideInitConnection initTLS+ where+ initTLS = \hostname sock -> do+ let defClientParams = modifyParams (defaultParamsClient hostname "")+ context <- contextNew sock defClientParams+ handshake context+ pure $+ let+ writeSock = \bs -> sendData context (toLazyByteString bs)+ readSock = recvData context+ closeSock = contextClose context+ in MkBufferArgs{..}
+ LICENSE view
@@ -0,0 +1,28 @@+BSD 3-Clause License++Copyright (c) 2025, Dmitry Kovalev++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++1. Redistributions of source code must retain the above copyright notice, this+ list of conditions and the following disclaimer.++2. Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++3. Neither the name of the copyright holder nor the names of its+ contributors may be used to endorse or promote products derived from+ this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain