Commit Graph

43 Commits

Author SHA1 Message Date
Efim Poberezkin
ac899a67c4 support TLS 1.3 (#300) 2022-01-18 18:59:02 +04:00
Evgeny Poberezkin
5e29e3698e binary SMP protocol encoding, split Command type to two types (#245)
* binary SMP protocol encoding (server tests fail)

* use 1 byte for bytestring length when encoding/decoding

* Encoding class, binary tags

* update server tests

* negotiate SMP version in client/server handshake

* add version columns to queues and connections

* split parsing SMP client commands and server responses to different functions

* check uniqueness of protocol tags

* split client commands and server responses/messages to separate types

* update types in SMP client

* remove pattern synonyms for SMP errors

* simplify getHandshake

* update SMP protocol encoding in protocol spec

* encode time as a number of seconds (64-bit integer) since epoch
2022-01-01 13:10:19 +00:00
Efim Poberezkin
de01692ffd enable WebSockets over TLS (#225) 2021-12-15 22:58:47 +04:00
Evgeny Poberezkin
cf3d0dfdc3 Transaction fields for size, session IDs, refactor (#222)
* add SMP session IDs/tls-unique to transmission

* refactor SMP transmissions: precise transmission types in server & client

* use correct session IDs

* remove TSession
2021-12-15 08:06:34 +00:00
Evgeny Poberezkin
83d352cfbe TLS 1.3 transport (#203)
* TLS as Transport class instance with pre-defined server certificate/key

* refactor error logging

* remove Ed25519

* refactor TLS.cGet

* TLS over TCP for Transport

* Plain -> TLS

* comment

* getLn, change supported cipher

* use non fixed certificates

* comment

* check options earlier

* wording

* headers

* Update apps/smp-server/Main.hs

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>

* Update apps/smp-server/Main.hs

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>

* localhost -> server

* Update apps/smp-server/Main.hs

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>

* remove comment

* agent key and cert fixtures WIP

* certificate and key in correct order

* exitFailure

* refactor loadServerCertificate

* remove liftIO

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>
2021-12-15 07:48:57 +00:00
Efim Poberezkin
5e380e1d47 add tests for establishing connection asynchronously; retrieve correct key for activation on restart (#169) 2021-07-10 20:02:48 +10:00
Evgeny Poberezkin
5b39f51203 websockets transport (#139)
* example websockets server

* example of ws client

* type class TConnection for  generic TCP/WebSockets implementation

* support WebSockets transport

* rename TConnection methods

* revert runClient to not need transport arg

* pass the list of ports and transports via SMP server config

* remove TypeApplications

* s/Transport/TProxy/, s/TConnection/Transport/

* fix server with multiple transports, make SMP client use WS transport with port 80 (TODO fallback to WS)
2021-05-17 22:33:12 +01:00
Evgeny Poberezkin
5d59e4b2bd package and module docs, remove Simplex.Markdown (moved to simplex-chat), rename Agent.Transmission to Agent.Protocol (#133)
* package and module docs, remove Simplex.Markdown (moved to simplex-chat), rename Agent.Transmission to Agent.Protocol

* move errors.md to haddock comments, Transport docs

* add CHANGELOG.md, add missing package versions

* changelog, copyright

* docs for Simplex.Messaging.Crypto

* consistent punctuation

* use absolute URLs in readme

* correction
2021-05-09 09:36:08 +01:00
Evgeny Poberezkin
5e3bc7ee6c improve error handling (#101)
* inventory of error handling problems and types

* Change SMP protocol errors syntax

* connection errors in agent protocol (ERR CONN), STORE error -> AGENT error

* include exception in SEInternal error

* add MESSAGE errors, remove CRYPTO and SIZE errors

* agent protocol SYNTAX and AGENT errors

* BROKER errors

* group all client command (and agent response) errors

* BROKER TRANSPORT error

* simplify Client

* clean up

* transport errors

* simplify client

* parse / serialize agent errors

* differentiate crypto errors

* update errors.md

* make agent and SMP protocol errors consistent, simplify

* update doc

* test: parse / serialize protocol errors with QuickCheck

* add String to internal error

* exponential back-off when retrying to send HELLO

* refactor Client.hs

* replace fold with recursion in startTCPClient

* fail test if server did not start, refactor

* test: wait till TCP server stops

* test: refactor waiting for server to stop

* test: fail with error if server did not start/stop
2021-04-18 18:37:54 +01:00
Efim Poberezkin
2eb5ce24ec tests: block on tcp server creation (#99)
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
2021-04-14 02:25:57 +04:00
Evgeny Poberezkin
e78b7a66d7 markdown tests (#86) 2021-04-10 13:12:28 +01:00
Evgeny Poberezkin
51cc602bdb agent store: refactor addSndQueue 2021-01-06 20:22:00 +00:00
Efim Poberezkin
94d0be5d27 add test for addSndQueue 2021-01-06 22:35:04 +04:00
Evgeny Poberezkin
5d2e77f41d test: agent SQLite createRcvConnection 2021-01-04 20:25:02 +00:00
Evgeny Poberezkin
f8e25189db move all tests from main Test to ServerTests 2021-01-04 18:49:28 +00:00
Evgeny Poberezkin
87f2c20ee4 type CorrelationId -> newtype CorrId (to avoid incorrect order in tuple) 2020-12-28 17:41:30 +00:00
Evgeny Poberezkin
43baacc5be move SMP server specific methods from Transport to Server/Transmission 2020-12-28 17:07:11 +00:00
Evgeny Poberezkin
e7581a91a8 test: update tests to include correclation ID in the tests themselves 2020-12-28 15:39:28 +00:00
Evgeny Poberezkin
4b8f6417f8 add correlationId to SMP transmissions, fix tests 2020-12-28 13:55:53 +00:00
Evgeny Poberezkin
3cb2421373 move modules to folder Simplex.Messaging.Server 2020-11-22 18:22:20 +00:00
Evgeny Poberezkin
35f83b604a rename "connection" to "queue" 2020-10-22 12:50:55 +01:00
Evgeny Poberezkin
3d322f5fcf test: error when ACK is sent without message 2020-10-21 18:17:11 +01:00
Evgeny Poberezkin
2527cf8a65 cancel subscribers when client disconnects, reject ACK if MSG was not delivered 2020-10-21 10:08:50 +01:00
Evgeny Poberezkin
acef2bf638 tests: deleting undelivered messages, re-delivery when message not ACKed 2020-10-18 10:15:30 +01:00
Evgeny Poberezkin
3012d4586f test: switching subscription to another TCP connection 2020-10-17 20:10:40 +01:00
Evgeny Poberezkin
0dec506ce6 test: duplex communication over 2 SMP connections 2020-10-17 19:42:15 +01:00
Evgeny Poberezkin
3255682bf2 use base64 encoded IDs and bytestrings instead of strings 2020-10-17 15:01:25 +01:00
Evgeny Poberezkin
ee40927506 random connection and message IDs 2020-10-17 11:03:38 +01:00
Evgeny Poberezkin
37eb4e7b71 remove connection ID from IDS response 2020-10-17 08:05:22 +01:00
Evgeny Poberezkin
9efcde6f57 fix: killing subscriber when smp connection is SUBd in another tcp connection 2020-10-16 22:29:21 +01:00
Evgeny Poberezkin
bd0f767282 message delivery 2020-10-16 13:24:26 +01:00
Evgeny Poberezkin
f3658abfbe rename command HOLD to OFF 2020-10-15 21:32:15 +01:00
Evgeny Poberezkin
693d9c529d change command names 2020-10-15 15:47:18 +01:00
Evgeny Poberezkin
c6b96a9cb2 replace ERROR SYNTAX 7 with ERROR SIZE for bad message body size 2020-10-15 14:30:42 +01:00
Evgeny Poberezkin
bedefb11b3 SUSPEND and DELETE connection 2020-10-15 11:55:10 +01:00
Evgeny Poberezkin
9f433285df hunit for assertions 2020-10-15 08:37:36 +01:00
Evgeny Poberezkin
b1f41d10da use assert in tests 2020-10-14 21:16:28 +01:00
Evgeny Poberezkin
2ba27ed852 SECURE command, tests 2020-10-14 21:03:37 +01:00
Evgeny Poberezkin
fbf17d3484 verify SEND command, refactor 2020-10-14 14:09:09 +01:00
Evgeny Poberezkin
989e0c7261 add error types 2020-10-14 11:37:45 +01:00
Evgeny Poberezkin
1daae74c67 syntax tests for all commands 2020-10-13 18:44:40 +01:00
Evgeny Poberezkin
00f61c1f68 protocol syntax tests 2020-10-13 18:17:41 +01:00
Evgeny Poberezkin
e75a3c44df test client (WIP) 2020-10-13 12:43:44 +01:00