From 70eb9052eb57ddceb1bff0352e98d27e2cc86d30 Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Tue, 29 Oct 2024 14:06:49 +0900 Subject: [PATCH] exporting defaults --- tls/Network/TLS.hs | 10 +++++++++- tls/Network/TLS/Hooks.hs | 1 + tls/Network/TLS/Parameters.hs | 29 ++++++++++++++++++----------- tls/Network/TLS/QUIC.hs | 2 +- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/tls/Network/TLS.hs b/tls/Network/TLS.hs index 70b25999c..bb8a61519 100644 --- a/tls/Network/TLS.hs +++ b/tls/Network/TLS.hs @@ -55,6 +55,7 @@ module Network.TLS ( -- ** Server parameters ServerParams, + defaultParamsServer, serverWantClientCert, serverCACertificates, serverDHEParams, @@ -67,6 +68,7 @@ module Network.TLS ( -- ** Shared Shared, + defaultShared, sharedCredentials, sharedSessionManager, sharedCAStore, @@ -75,6 +77,7 @@ module Network.TLS ( -- ** Client hooks ClientHooks, + defaultClientHooks, OnCertificateRequest, onCertificateRequest, OnServerCertificate, @@ -85,6 +88,7 @@ module Network.TLS ( -- ** Server hooks ServerHooks, + defaultServerHooks, onClientCertificate, onUnverifiedClientCert, onCipherChoosing, @@ -99,6 +103,7 @@ module Network.TLS ( -- ** Supported Supported, + defaultSupported, supportedVersions, supportedCiphers, supportedCompressions, @@ -113,6 +118,7 @@ module Network.TLS ( -- ** Debug parameters DebugParams, + defaultDebugParams, debugSeed, debugPrintSeed, debugVersionForced, @@ -231,6 +237,7 @@ module Network.TLS ( -- ** Modifying hooks in context Hooks, + defaultHooks, hookRecvHandshake, hookRecvHandshake13, hookRecvCertificates, @@ -242,6 +249,7 @@ module Network.TLS ( contextHookSetHandshake13Recv, contextHookSetCertificateRecv, Logging, + defaultLogging, loggingPacketSent, loggingPacketRecv, loggingIOSent, @@ -324,7 +332,7 @@ import Network.TLS.X509 import Data.ByteString as B import Data.X509 (PrivKey (..), PubKey (..)) -import Data.X509.Validation hiding (HostName) +import Data.X509.Validation hiding (HostName, defaultHooks) {-# DEPRECATED Bytes "Use Data.ByteString.Bytestring instead of Bytes." #-} type Bytes = B.ByteString diff --git a/tls/Network/TLS/Hooks.hs b/tls/Network/TLS/Hooks.hs index 9d8ad0aba..400be1d90 100644 --- a/tls/Network/TLS/Hooks.hs +++ b/tls/Network/TLS/Hooks.hs @@ -1,5 +1,6 @@ module Network.TLS.Hooks ( Logging (..), + defaultLogging, Hooks (..), defaultHooks, ) where diff --git a/tls/Network/TLS/Parameters.hs b/tls/Network/TLS/Parameters.hs index 68c43bf69..c922d724d 100644 --- a/tls/Network/TLS/Parameters.hs +++ b/tls/Network/TLS/Parameters.hs @@ -1,17 +1,21 @@ module Network.TLS.Parameters ( ClientParams (..), + defaultParamsClient, ServerParams (..), + defaultParamsServer, CommonParams, DebugParams (..), + defaultDebugParams, ClientHooks (..), + defaultClientHooks, OnCertificateRequest, OnServerCertificate, ServerHooks (..), + defaultServerHooks, Supported (..), + defaultSupported, Shared (..), - - -- * special default - defaultParamsClient, + defaultShared, -- * Parameters MaxFragmentEnum (..), @@ -409,14 +413,17 @@ data Shared = Shared instance Show Shared where show _ = "Shared" instance Default Shared where - def = - Shared - { sharedCredentials = mempty - , sharedSessionManager = noSessionManager - , sharedCAStore = mempty - , sharedValidationCache = def - , sharedHelloExtensions = [] - } + def = defaultShared + +defaultShared :: Shared +defaultShared = + Shared + { sharedCredentials = mempty + , sharedSessionManager = noSessionManager + , sharedCAStore = mempty + , sharedValidationCache = def + , sharedHelloExtensions = [] + } -- | Group usage callback possible return values. data GroupUsage diff --git a/tls/Network/TLS/QUIC.hs b/tls/Network/TLS/QUIC.hs index 57f431b36..75a7873be 100644 --- a/tls/Network/TLS/QUIC.hs +++ b/tls/Network/TLS/QUIC.hs @@ -81,7 +81,7 @@ import Network.TLS.Handshake.State import Network.TLS.Handshake.State13 import Network.TLS.Imports import Network.TLS.KeySchedule (hkdfExpandLabel, hkdfExtract) -import Network.TLS.Parameters +import Network.TLS.Parameters hiding (defaultSupported) import Network.TLS.Record.Layer import Network.TLS.Record.State import Network.TLS.Struct