From ff2b975cd814e08be1d938d6864638007db47b19 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Wed, 8 Dec 2021 15:02:28 +0000 Subject: [PATCH] prepare v0.5.0 - update versions, changelog (#219) * prepare v0.5.0 - update versions, changelog * Update CHANGELOG.md Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com> --- CHANGELOG.md | 10 ++++++++++ package.yaml | 2 +- simplexmq.cabal | 4 ++-- src/Simplex/Messaging/Agent.hs | 4 ++-- src/Simplex/Messaging/Transport.hs | 10 +++++++--- tests/SMPAgentClient.hs | 2 +- 6 files changed, 23 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88c920a23..bbdcff942 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# 0.5.0 + +- No changes in SMP server implementation - it is backwards compatible with v0.4.1 +- SMP agent changes: + - URI syntax for SMP queues and connection requests. + - long-term connections links ("contacts") in SMP agent protocol. + - agent command changes: + - `REQ` notification and `ACPT` command are used only with long-term connection links. + - `CONF` notification and `LET` commands are used for normal duplex connections. + # 0.4.1 - Include migrations in the package diff --git a/package.yaml b/package.yaml index a32507ff3..828811db9 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: simplexmq -version: 0.4.1 +version: 0.5.0 synopsis: SimpleXMQ message broker description: | This package includes <./docs/Simplex-Messaging-Server.html server>, diff --git a/simplexmq.cabal b/simplexmq.cabal index 53291b95b..554d17f7b 100644 --- a/simplexmq.cabal +++ b/simplexmq.cabal @@ -4,10 +4,10 @@ cabal-version: 1.12 -- -- see: https://github.com/sol/hpack -- --- hash: 1e44584019db4d35d25a97c553870b0960fe7a18b5296f0e49b8084c343276ab +-- hash: 3bdb491a0318dc4b53cba4131f192e4c4e17b42e88043495666d1688a1f95443 name: simplexmq -version: 0.4.1 +version: 0.5.0 synopsis: SimpleXMQ message broker description: This package includes <./docs/Simplex-Messaging-Server.html server>, <./docs/Simplex-Messaging-Client.html client> and diff --git a/src/Simplex/Messaging/Agent.hs b/src/Simplex/Messaging/Agent.hs index c56063470..68c8586dd 100644 --- a/src/Simplex/Messaging/Agent.hs +++ b/src/Simplex/Messaging/Agent.hs @@ -86,7 +86,7 @@ import Simplex.Messaging.Client (SMPServerTransmission) import qualified Simplex.Messaging.Crypto as C import Simplex.Messaging.Protocol (MsgBody, SenderPublicKey) import qualified Simplex.Messaging.Protocol as SMP -import Simplex.Messaging.Transport (ATransport (..), TProxy, Transport (..), runTransportServer) +import Simplex.Messaging.Transport (ATransport (..), TProxy, Transport (..), currentSMPVersionStr, runTransportServer) import Simplex.Messaging.Util (bshow, tryError) import System.Random (randomR) import UnliftIO.Async (Async, async, race_) @@ -110,7 +110,7 @@ runSMPAgentBlocking (ATransport t) started cfg@AgentConfig {tcpPort} = runReader where smpAgent :: forall c m'. (Transport c, MonadUnliftIO m', MonadReader Env m') => TProxy c -> m' () smpAgent _ = runTransportServer started tcpPort $ \(h :: c) -> do - liftIO $ putLn h "Welcome to SMP v0.4.1 agent" + liftIO . putLn h $ "Welcome to SMP agent v" <> currentSMPVersionStr c <- getAgentClient logConnection c True race_ (connectClient h c) (runAgentClient c) diff --git a/src/Simplex/Messaging/Transport.hs b/src/Simplex/Messaging/Transport.hs index f881af3ec..10b470c98 100644 --- a/src/Simplex/Messaging/Transport.hs +++ b/src/Simplex/Messaging/Transport.hs @@ -45,6 +45,7 @@ module Simplex.Messaging.Transport tGetEncrypted, serializeTransportError, transportErrorP, + currentSMPVersionStr, -- * Trim trailing CR trimCR, @@ -63,7 +64,7 @@ import Data.ByteArray (xor) import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as B import Data.Functor (($>)) -import Data.Maybe(fromMaybe) +import Data.Maybe (fromMaybe) import Data.Set (Set) import qualified Data.Set as S import Data.String @@ -221,7 +222,10 @@ major :: SMPVersion -> (Int, Int) major (SMPVersion a b _ _) = (a, b) currentSMPVersion :: SMPVersion -currentSMPVersion = "0.4.1.0" +currentSMPVersion = "0.5.0.0" + +currentSMPVersionStr :: ByteString +currentSMPVersionStr = serializeSMPVersion currentSMPVersion serializeSMPVersion :: SMPVersion -> ByteString serializeSMPVersion (SMPVersion a b c d) = B.intercalate "." [bshow a, bshow b, bshow c, bshow d] @@ -372,7 +376,7 @@ serverHandshake c srvBlockSize (k, pk) = do liftError (const $ TEHandshake DECRYPT) (C.decryptOAEP pk encKeys) >>= liftEither . parseClientHandshake sendWelcome_6 :: THandle c -> ExceptT TransportError IO () - sendWelcome_6 th = ExceptT . tPutEncrypted th $ serializeSMPVersion currentSMPVersion <> " " + sendWelcome_6 th = ExceptT . tPutEncrypted th $ currentSMPVersionStr <> " " -- | Client SMP encrypted transport handshake. -- diff --git a/tests/SMPAgentClient.hs b/tests/SMPAgentClient.hs index 99d2336ce..3bd6315ac 100644 --- a/tests/SMPAgentClient.hs +++ b/tests/SMPAgentClient.hs @@ -189,7 +189,7 @@ testSMPAgentClientOn :: (Transport c, MonadUnliftIO m) => ServiceName -> (c -> m testSMPAgentClientOn port' client = do runTransportClient agentTestHost port' $ \h -> do line <- liftIO $ getLn h - if line == "Welcome to SMP v0.4.1 agent" + if line == "Welcome to SMP agent v" <> currentSMPVersionStr then client h else error $ "wrong welcome message: " <> B.unpack line