Commit Graph
395 Commits
Author SHA1 Message Date
Lee Smet d0c8a813d5 Allow long poll when reading new messages
Also unify the peek and pop handlers

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-27 15:45:51 +02:00
Lee Smet def11c5a6e Make status variable of message lowercase in API
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-27 13:08:06 +02:00
Lee Smet b01d7f0fb3 Allow sending messages to public keys as well
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-27 13:05:33 +02:00
Lee Smet c653c6be23 Add SRC and DST IP when peeking/popping message
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-27 11:37:37 +02:00
Lee Smet 0bb0ec740f Add warning log when starting without TUN
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-27 11:05:44 +02:00
Lee Smet 08db57a6a0 Update message API doc paths
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-27 11:05:33 +02:00
Lee Smet bf983cd847 Add /api/v1 route prefix to message routes
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-27 11:01:32 +02:00
Lee Smet 9a4e81d6e5 Allow starting the system without creating TUN
This means only the message subsystem is exposed

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-27 10:44:31 +02:00
Lee Smet 8bb067e921 Add .vscode to .gitignore
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-26 13:59:00 +02:00
Lee Smet e8cb8b425c Remove .vscode dir
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-26 13:58:29 +02:00
Lee Smet 94eb831227 Add initial API spec
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-26 13:54:36 +02:00
Lee Smet a417df8d5a Use NOT_FOUND for status when id doesn't exist
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-26 11:37:57 +02:00
Lee Smet 4eb1f7f8ab Fix sending READ notification
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-25 17:19:04 +02:00
Lee Smet 8bcf7aa3a3 Add debug log when sending READ notification
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-25 17:05:11 +02:00
Lee Smet ef3318b0cf Add some more logs for messages
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-25 16:47:08 +02:00
Lee Smet 318896893f Fix calculation of last chunk idx in size check
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-25 15:37:31 +02:00
Lee Smet 7646160531 Improve debug msg on CHUNK drop for small size
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-25 15:23:53 +02:00
Lee Smet 99f6835db2 Fix PacketBuffer after decryption
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-25 15:14:59 +02:00
Lee Smet 2cf1f60890 Set proper size on PacketBuffer
When working with a MessagePacket, ensure the proper size of the used
part of the underlying PacketBuffer is set.

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-25 14:49:13 +02:00
Lee Smet e09bf2603c Use correct namespace to set p6 ip
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-25 10:57:08 +02:00
Lee Smet 6be6f3ce3e Remove useless formats
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-25 10:55:51 +02:00
Lee Smet d0e31c064d Use public keys to identify parties in message API
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-25 10:54:56 +02:00
Lee Smet fa33bac9f8 Use standard base64 alphabet
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-25 10:52:00 +02:00
Lee Smet 08c46b57a2 Add HTTP API to interact with messages
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-24 17:24:12 +02:00
Lee Smet 160e9ec021 Add base64 dependency
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-24 15:48:22 +02:00
Lee Smet a7b81d6d5c Fix module doc in subnet module.
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-24 13:46:20 +02:00
Lee Smet 236673be75 Update dependencies
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-24 10:49:23 +02:00
Lee Smet b945caf503 Add axum dependency
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-24 10:47:04 +02:00
Lee Smet a4d54faba8 Fix RouteKey PartialOrd implementation
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:59:18 +02:00
Lee Smet d397a1fa26 Clean up code in message.rs
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:57:05 +02:00
Lee Smet 4cf601b22e Finish sending messages
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00
Lee Smet 848c375251 Change completed message collection to VecDequeue
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00
Lee Smet 7de0cc0bf2 Set message ID when sending init packet
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00
Lee Smet 0167df4b5e Transform chunks
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00
Lee Smet 0a00985698 Generate replies for received message packets
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00
Lee Smet c8f53562ad Implement message reassembly and checksum
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00
Lee Smet 8f319439d9 Add Blake3 dependency
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00
Lee Smet de84528351 Implement message handling
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00
Lee Smet 139fb238ba Start message processing
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00
Lee Smet 492ac7ef80 Allow access to Flags field without mutable ref
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00
Lee Smet a02725120e Take proper type in Flags PhantomData marker
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00
Lee Smet a57b85303e Add tests to see if message constructors set flags
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00
Lee Smet 64fa8758b5 Expose Flags on (mutable) message header
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00
Lee Smet 37104e46fa Add into_inner methods for message types
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00
Lee Smet 25e61c4fac Set right flag on buffer when creating messages
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00
Lee Smet 71abca419a Move flags modifiers to FlagsMut struct
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00
Lee Smet 74b80a09a9 Flesh out individual message format
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00
Lee Smet d92587c5ea Add owned MessagePacket and MessageInit
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00
Lee Smet e22abebb11 Add submodules for message types
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00
Lee Smet 8fdc0d95da Add MessagePacketMut
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-10-23 15:35:15 +02:00