From 722864c842dea4306ba77cb38f532116864ba7bf Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Wed, 17 Nov 2021 15:32:39 -0500 Subject: [PATCH] name changes changed names of certain functions and types to use the term "capsule" instead of "server" --- src/Network/Gemini/Capsule.hs | 22 ++++++++--------- src/Network/Gemini/Capsule/Types.hs | 38 ++++++++++++++--------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/Network/Gemini/Capsule.hs b/src/Network/Gemini/Capsule.hs index b51eb7f..5540e49 100644 --- a/src/Network/Gemini/Capsule.hs +++ b/src/Network/Gemini/Capsule.hs @@ -32,7 +32,7 @@ License along with this program. If not, see module Network.Gemini.Capsule ( -- * Running a Gemini Server - runGemServer, + runGemCapsule, -- * Encoding/Decoding Functions encodeGemURL, decodeGemURL, @@ -64,24 +64,24 @@ import System.IO.Streams.TLS (accept) import Network.Gemini.Capsule.Internal import Network.Gemini.Capsule.Types --- | Builds and runs a Gemini server -runGemServer - :: GemServSettings - -- ^ The server settings +-- | Builds and runs a Gemini capsule +runGemCapsule + :: GemCapSettings + -- ^ The capsule settings -> GemHandler -- ^ The handler -> IO a -runGemServer settings handler = bracket +runGemCapsule settings handler = bracket ( bindAndListen - (servConnections settings) - (fromIntegral $ servPort settings) + (capConnections settings) + (fromIntegral $ capPort settings) ) S.close ( \sock -> do params <- makeServerParams - (servCert settings) - (servCertChain settings) - (servKey settings) + (capCert settings) + (capCertChain settings) + (capKey settings) listenLoop sock params handler ) diff --git a/src/Network/Gemini/Capsule/Types.hs b/src/Network/Gemini/Capsule/Types.hs index 4e31ad1..126c934 100644 --- a/src/Network/Gemini/Capsule/Types.hs +++ b/src/Network/Gemini/Capsule/Types.hs @@ -30,12 +30,12 @@ module Network.Gemini.Capsule.Types ( GemRequest (..), GemResponse (..), GemHandler, - GemServSettings (..), + GemCapSettings (..), -- * Constructors newGemURL, newGemRequest, newGemResponse, - newGemServSettings + newGemCapSettings ) where import qualified Data.ByteString.Lazy as BSL @@ -75,17 +75,17 @@ data GemResponse = GemResponse -- | Handles a 'GemRequest' to produce a 'GemResponse' type GemHandler = GemRequest -> IO GemResponse --- | The settings required to set up a Gemini server -data GemServSettings = GemServSettings - { servConnections :: Int +-- | The settings required to set up a Gemini capsule +data GemCapSettings = GemCapSettings + { capConnections :: Int -- ^ Number of simultaneous connections allowed - , servPort :: Word16 - -- ^ The server port number - , servCert :: FilePath - -- ^ The path to the server certificate - , servCertChain :: [FilePath] + , capPort :: Word16 + -- ^ The capsule port number + , capCert :: FilePath + -- ^ The path to the TLS certificate + , capCertChain :: [FilePath] -- ^ The paths to the chain certificates - , servKey :: FilePath + , capKey :: FilePath -- ^ The path to the private key } deriving (Eq, Show) @@ -120,18 +120,18 @@ newGemResponse = GemResponse } -- | Builds a reasonable set of server settings. -newGemServSettings +newGemCapSettings :: FilePath -- ^ Path to the server certificate -> FilePath -- ^ Path to the private key - -> GemServSettings -newGemServSettings cert key = GemServSettings - { servConnections = 100 - , servPort = 1965 - , servCert = cert - , servCertChain = [] - , servKey = key + -> GemCapSettings +newGemCapSettings cert key = GemCapSettings + { capConnections = 100 + , capPort = 1965 + , capCert = cert + , capCertChain = [] + , capKey = key } --jl