Commit Graph

57 Commits

Author SHA1 Message Date
Evgeny Poberezkin
acdf4f41c5 XFTP: CLI tests, output command results, info command (#642)
* XFTP: CLI tests, output command results

* info command, test

* fix test
2023-02-17 11:38:43 +00:00
Stanislav Dmitrenko
bccef0ba47 files: server and client spike - basic upload/download (#591)
* Files: main, env, stats, storeLog

* Better + transport

* Executable

* Env

* Update Client.hs, Server.hs, and 4 more files...

* Answer on request

* Delay

* Temp file

* Bypass cert check

* update package.yml, rename

* update store log

* extend HTTP2 transport

* refactor caStore

* HTTP2 body

* update server stats

* file server/client framework

* verify server commands

* process FNEW command, CLI test works

* simple XFTP server test (fails)

* fix test, refactor

* upload chunk works

* receive file chunk in the client

* remove transport handshake

* typo

Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com>

* fix names

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com>
2023-02-13 13:36:02 +00:00
JRoberts
1523c00bcc files: file description types (#631) 2023-02-09 21:22:58 +04:00
Evgeny Poberezkin
c77e7f7e43 remove tests/tmp folder after every test (#625) 2023-01-29 22:10:07 +00:00
Evgeny Poberezkin
5e31c60c35 do not show warning on server restart when restoring "quota" message and quota is exceeded (#603)
* do not show warning on server restart when restoring "quota" message and quota is exceeded

* complete case

* line break
2023-01-12 23:26:21 +00:00
Evgeny Poberezkin
058e3ac55e send/process "quota exceeded" message from SMP server when sender gets ERR QUOTA (#585)
* send "quota exceeded" message from SMP server when sender gets ERR QUOTA (ignored in the agent for now)

* send msg quota to the recipient to indicate that sender got ERR QUOTA, test

* switch between slow/fast retry intervals (tests do not pass yet)

* send QCONT message, refactor RetryInterval, test

* refactor

* remove comment

* remove space

* unit test for withRetryLock2

* refactor
2023-01-04 14:10:13 +00:00
Evgeny Poberezkin
f53c1f5559 server: clear folders during initialization instead of deleting them (#572) 2022-11-28 07:40:59 +00:00
Evgeny Poberezkin
43fb513ef7 initialize SMP server interactively, CLI options (#566)
* initialize SMP server interactively, CLI options

* correction

Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com>

* corrections

Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com>
2022-11-18 19:07:41 +00:00
Evgeny Poberezkin
40000047af server: refactor CLIs, tests (#564)
* server: refactor CLIs, tests

* add files, test

* rename Executable -> Main
2022-11-17 19:43:01 +00:00
Evgeny Poberezkin
eb5c1c78cb connection queue redundancy and rotation (#521)
* rfc: queue rotation

* update rfc

* messages for queue rotation

* allow multiple subscribed queues per connection in Agent/Client.hs

* refactor

* fix module name

* allow multiple queues in duplex connection type

* update commands

* add indices

* addConnectionRcvQueue

* switch connection to another queue (WIP)

* update schema/protocol

* switching queue works, but sending messages after the switch fails

* messages are delivered after rotation

* use connection-scoped queue ID

* rename queue records fields

* refactor using SMPQueue class/instances

* simplify queries

* QKEY: check queue is not secured, refactor

* update rfc

* mark queue as primary in QUSE

* queue rotation errors

* fix async ack

* fix async ACK to send OK

* correction

Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com>

* use SWCH command

* rename

* take into account only active queue subscription when determining connection result if at least one queue is active

* remove comment

* only enable notifications for connections with enableNtfs = True

* async test (WIP)

* async queue rotation test

* simplify combining results

* test with 2 servers

* fix unused subscribeConnection

* switch to cabal build

* increase build timeout

* increase delay in async test

* skip queue rotation tests

* build matrix

* step name

* use ubuntu-18.04 in build matrix

* enable rotation tests

Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com>
2022-10-29 18:57:01 +01:00
Evgeny Poberezkin
7f81396b09 prevent pad/unpad failures on large/small messages (#547)
* prevent pad/unpad failures on large/small messages

Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com>
2022-10-19 20:53:29 +01:00
JRoberts
bfb556c860 ntf: test notification subscription (#389) 2022-06-07 19:14:51 +04:00
Evgeny Poberezkin
17888f89a9 test notification token with agent and notifications server (#353)
* test notification token with agent and notifications server

* notification server test with APNS mock

* set environment variables in the test

* use base64url encoding in encrypted notification data
2022-04-18 08:57:55 +01:00
Evgeny Poberezkin
f577fcdacf agent schema/methods/types/store methods for notifications tokens (#348)
* agent schema/methods/types/store methods for notifications tokens

* register notification token on the server

* agent commands for notification tokens

* refactor initial servers from AgentConfig

* agent store functions for notification tokens

* server STM store methods for tokens

* fix protocol client for ntfs (use generic handshake), minimal server and agent tests

* server command to verify ntf token
2022-04-08 08:47:04 +01:00
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