Commit Graph

69 Commits

Author SHA1 Message Date
56e72928c6 fix use after free 2025-05-10 21:46:53 -04:00
a80c9abfe7 Attempt to base64 encode the connection payload
For some reason I am still getting this:

2025/05/10 16:37:06 Error decoding message: SGVsbG8gZGFya25lc3MgbXkgb2xkIGZyaWVuZA==::53475673624738675a4746796132356c63334d6762586b676232786b49475a79615756755a413d3daaaa
2025-05-10 21:46:53 -04:00
245dab4909 Use slice for init, and add better error sets.
The slice sets us avoid allocating within the init function.
This means init can't fail, and it also makes it easier to stack allocate messages (slice an array buffer, instead of creating a stack allocator).
2025-05-10 21:46:53 -04:00
cde5c3626c 2025-05-10 21:46:53 -04:00
e84d1a2300 2025-05-10 21:46:53 -04:00
1b7d9bbb1a Remove bytesAsValueUnchecked
Callers can instead use std.mem.bytesAsValue directly.
2025-05-10 21:46:53 -04:00
1512ec1a86 Cleanup asBytes and test it 2025-05-10 21:46:53 -04:00
f1dce257be Simplify init interface 2025-05-10 21:46:53 -04:00
bcab1e4d00 2025-05-10 21:46:53 -04:00
0e8f016978 Align the bytes instead of the struct 2025-05-10 21:46:53 -04:00
fc53e87389 2025-05-10 21:46:53 -04:00
cbf554e853 2025-05-10 21:46:53 -04:00
775212013f 2025-05-10 21:46:53 -04:00
339ac5cfe5 2025-05-10 21:46:53 -04:00
eacfaffb6b 2025-05-10 21:46:53 -04:00
1731b2e643 2025-05-10 21:46:53 -04:00
dae66a0039 Starting real connections 2025-05-10 21:46:53 -04:00
683a2015b0 Use FAIL as the default dest if unable to parse 2025-04-27 18:03:06 -04:00
c34748dab3 Add CLI to specify dest for relay messages
The dest can be specified as a 4 char ASCII string, or as an IPv4 address.
2025-04-19 22:26:32 -04:00
5b88f0df6a Rename Saprus to Client internally 2025-04-14 07:13:09 -04:00
23f7ad8f94 Break out the impl to a lib
This will make it easier to make a C library.
2025-04-13 17:14:18 -04:00
8779b29149 Do some things for invy 2025-04-13 16:41:20 -04:00
0f4a7c9bcd Use dynamic array instead of arraylist
we know the size (assuming the len is correct) so we can preallocate the whole array
2025-04-06 21:33:00 -04:00
2302e6930d Depend on clap the same way as network 2025-04-06 13:08:09 -04:00
935e552a59 Don't print help after sending message 2025-04-06 13:08:09 -04:00
3424217539 Add comment for cli example reference 2025-04-06 13:08:09 -04:00
dcb962593d Allow caller to specify what kind of message to send with arg 2025-04-06 13:08:09 -04:00
c2f8c77c52 Nicer message for no response 2025-04-06 13:08:09 -04:00
6eef36e78a Handle network blocking well 2025-04-06 13:08:09 -04:00
8278648ba9 Don't use multi threading where it is not required 2025-04-06 13:08:09 -04:00
6b38d5bb74 Last handshake packet uses non 8888 port 2025-04-06 13:08:09 -04:00
ec94e85ab9 Complete the handshake 2025-04-06 13:08:09 -04:00
a2072436aa Receive and print the response from the sentinel 2025-04-06 13:08:09 -04:00
774d52ad59 Initial awaiting for handshake response
seems like i might be getting my own initial connection?
I get a response even without the sentinal running.
2025-04-06 13:08:09 -04:00
b219fdc1f5 Start proper connection handshake 2025-04-06 13:08:09 -04:00
433a97fe5a Move binary back to zaprus
Also clean up the args for the aux functions by computing the type instead of passing it
2025-04-06 13:08:09 -04:00
3c935698aa Correctly handle the endiness and packedness of the the header reading and writing 2025-04-06 13:08:09 -04:00
bc75e86904 Write the header as a packed int
this seems like the best way to do it.
2025-04-06 13:08:09 -04:00
ac5511e9bd Not using writer
Use direct mem copying into the buf instead of writing to it with the writer interface.
Probably better to use the writer actually, since this suffers from the same issue with the extra two null bytes.
2025-04-06 13:08:09 -04:00
efcd866d6c Initial testing of connection message 2025-04-06 13:08:09 -04:00
7b07520adb Move sendRelay logic to Saprus struct 2025-04-06 13:08:09 -04:00
448e900004 Break relay into a specific program 2025-04-06 13:08:09 -04:00
93161ff4bd Move types to their own file
Make it so I can specify the payload message
2025-04-06 13:08:09 -04:00
58ed9048da GREATLY improve clarity 2025-04-06 13:08:09 -04:00
88b2734886 Move dba to top level scope
This makes it so references to it are lazily compiled, so I can throw a compileError if it is referenced in the wrong mode.
2025-04-06 13:08:09 -04:00
e24220c98b add comments!!!!! 2025-04-06 13:08:09 -04:00
b1def25c69 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-06 13:08:09 -04:00
d60d1fd335 Remove redundant comptime
Move edge together at the end of the switch
2025-04-06 13:08:09 -04:00
ef36894c70 Properly initialize the SaprusMessage fromBytes
Will actually use the provided packet type inline.
2025-04-06 13:08:09 -04:00
a0f6e08794 dedup some
Still need to clean up fromBytesAux
2025-04-06 13:08:09 -04:00