feat: add ratchet, streaming, SU3 reseed, and router floodfill
- Add ratchet/ with ECIES-X25519-AEAD-Ratchet (Proposal 144), Garlic cloves, and ECIES DatabaseLookup replies - Add streaming/ with Ed25519-signed I2P Streaming (SYN/ACK/NACK/CLOSE/RESET, retransmit, window) and Repliable/Raw Datagrams - Add common/su3.mbt to parse and verify reseed .su3 bundles - Add Elligator2 encoding in crypto/ and OfflineSignature support in LeaseSet2 (flags bit 0) - Router: NTCP2 peer pool, floodfill NetDB crawl, transit tunnel relay, and Garlic/Streaming bridge - cmd/router: add --peer-dir, --su3, --reseed, --floodfill, --no-clock-skew - cmd/client: add --dest for persistent destination keys - Mark Phase 6 complete in README and document the transport scope (NTCP2 only, no SSU2)
This commit is contained in:
1 parent
8eafa11b22
commit
ae72b00323
54 files changed
+9607
-704
No files matched your search
@@ -11,6 +11,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -192,3 +193,52 @@ MOONBIT_FFI_EXPORT
|
||||
void moon_i2p_flush_stdout(void) {
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
MOONBIT_FFI_EXPORT
|
||||
int32_t moon_i2p_file_size(moonbit_bytes_t path_bytes, int32_t path_len) {
|
||||
if (path_len <= 0 || path_len >= 1024) {
|
||||
set_last_error("invalid file path");
|
||||
return -1;
|
||||
}
|
||||
char path[1024];
|
||||
memcpy(path, path_bytes, (size_t)path_len);
|
||||
path[path_len] = '\0';
|
||||
struct stat st;
|
||||
if (stat(path, &st) < 0) {
|
||||
set_last_error(strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (!S_ISREG(st.st_mode)) {
|
||||
set_last_error("not a regular file");
|
||||
return -1;
|
||||
}
|
||||
return (int32_t)st.st_size;
|
||||
}
|
||||
|
||||
MOONBIT_FFI_EXPORT
|
||||
int32_t moon_i2p_read_file(
|
||||
moonbit_bytes_t path_bytes,
|
||||
int32_t path_len,
|
||||
moonbit_bytes_t dst,
|
||||
int32_t max_len) {
|
||||
if (path_len <= 0 || path_len >= 1024) {
|
||||
set_last_error("invalid file path");
|
||||
return -1;
|
||||
}
|
||||
char path[1024];
|
||||
memcpy(path, path_bytes, (size_t)path_len);
|
||||
path[path_len] = '\0';
|
||||
FILE *f = fopen(path, "rb");
|
||||
if (!f) {
|
||||
set_last_error(strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
size_t n = fread(dst, 1, (size_t)max_len, f);
|
||||
if (ferror(f)) {
|
||||
set_last_error(strerror(errno));
|
||||
fclose(f);
|
||||
return -1;
|
||||
}
|
||||
fclose(f);
|
||||
return (int32_t)n;
|
||||
}
|
||||
Reference in new issue
Block a user