Commit Graph

23 Commits

Author SHA1 Message Date
797624377a move aux funcs back into the union
also move the body of the base64 handling back to the only place it is used now
2025-04-03 16:21:33 -04:00
3d8fa5e33c Remove redundant comptime
Move edge together at the end of the switch
2025-04-03 16:08:05 -04:00
0a441d2bce Properly initialize the SaprusMessage fromBytes
Will actually use the provided packet type inline.
2025-04-03 16:02:31 -04:00
748991d35b dedup some
Still need to clean up fromBytesAux
2025-04-03 16:02:31 -04:00
f1fa898299 Break out encoding and decoding into its own functions 2025-04-03 16:02:31 -04:00
62c0b1aab0 Add decoding connection messages 2025-04-03 16:02:31 -04:00
6e61e353e5 Add packet decoding
Big bug where I was setting the payload length do be the pre-encoded size rather than the encoded size.
2025-04-03 16:02:31 -04:00
8dc3e5d949 Small cleanup
Rename allocator to gpa (general purpose allocator) and move DebugAllocator type out of main
2025-04-03 11:29:44 -04:00
0d8155f0af Remove unnecessary explicit cast
Remove unnecessary Self declaration.
2025-04-03 11:02:55 -04:00
50859a22dc Specify endianness when writing the header struct 2025-04-03 10:33:07 -04:00
5f939c37af Explicitly specify the size of connection options
This makes it so specifying the wrong number of options would actually throw a compile time error.
2025-04-03 10:28:48 -04:00
322d0b3a52 Clean up string handling 2025-04-03 10:23:15 -04:00
4fc8ec4087 Make header always a packed struct
This lets us easily use the same writeStructe(header) pattern to write the header for each message type.
2025-04-03 10:16:16 -04:00
6a6c3c8519 Base64 encode relay message
write the packed connection struct directly instead of each of the fields.
2025-04-02 23:43:35 -04:00
fc06420746 Add connection message type 2025-04-02 23:26:57 -04:00
62e6fbbff6 Remove tests 2025-04-02 23:00:25 -04:00
e07de8564c Working with nice union
This let's us easily use a single type for all Saprus messages, and unwrap the specific type with a switch.
2025-04-02 22:59:18 -04:00
6a9a57a690 it works! 2025-04-02 22:05:10 -04:00
ab8792efce Getting some data but malformed
This is what the data shows up in the sentinal looking like:

2025/04/02 22:36:32 Error decoding message: Hello darkness my old friend::48656c6c6f206461726b6e657373206d79206f6c6420667269656e64aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
2025/04/02 22:36:32 INFO: Relay message received: Hello darkness my old friend
2025-04-02 18:36:45 -04:00
7b7c466690 Add msgs with toBytes functions 2025-04-02 18:09:24 -04:00
18763983e2 Added network dep 2025-04-02 18:08:22 -04:00
3354a85c1a Remove lib 2025-04-02 18:08:22 -04:00
6cecaecf39 Initial commit 2025-04-02 17:26:16 -04:00