From f0f91540be2050cd12ce7de77e609522624e1de0 Mon Sep 17 00:00:00 2001 From: divo <418@cryspace.space> Date: Thu, 16 Oct 2025 14:08:14 -0400 Subject: [PATCH] fix keys.h typo, began dat_net c/h --- inc/dat_net.h | 33 +++++++++++++++++++++++++++++++++ inc/keys.h | 6 +++--- src/cesspool.c | 2 ++ src/dat_net.c | 4 ++++ 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 inc/dat_net.h diff --git a/inc/dat_net.h b/inc/dat_net.h new file mode 100644 index 0000000..891e5bf --- /dev/null +++ b/inc/dat_net.h @@ -0,0 +1,33 @@ +#ifndef DAT_NET_H +#define DAT_NET_H + +#include +#include +#include + +#define DATNET_PORT 3282 +#define DATNET_MAX_PACKET 1400 +#define DATNET_TOPIC_BYTES 32 +#define DATNET_PEERID_BYTES 32 + +typedef struct { + int fd; + struct sockaddr_storage addr; + socklen_t addrlen; + uint8_t id[DATNET_PEERID_BYTES]; +} dat_peer_t; + +typedef struct { + int sock; + uint8_t topic[DATNET_TOPIC_BYTES]; + uint8_t peerid[DATNET_PEERID_BYTES]; + void (*on_message)(dat_peer_t *peer, const uint8_t *msg, size_t len); +} datnet_t; + +int datnet_init(); +int datnet_bind(); +int datnet_poll(); +int datnet_send(); +int datnet_close(datnet_t *net); + +#endif /* DAT_NET_H */ diff --git a/inc/keys.h b/inc/keys.h index 25270a9..fb65da4 100644 --- a/inc/keys.h +++ b/inc/keys.h @@ -5,12 +5,12 @@ #define SLEEP_PUB_KEY_BYTES 32 #define SLEEP_SECRET_KEY_BYTES 64 -#define SLEEP_SIGNATURE_BYES 64 -#define SLEEP_BLAKE2B_BYES 32 +#define SLEEP_SIGNATURE_BYTES 64 +#define SLEEP_BLAKE2B_BYTES 32 typedef struct { uint8_t pubkey[SLEEP_PUB_KEY_BYTES]; - uint8_t seckey[SLEEP_SECRET_KEY_BYES]; + uint8_t seckey[SLEEP_SECRET_KEY_BYTES]; } sleep_keypair_t; diff --git a/src/cesspool.c b/src/cesspool.c index 76eed1f..9980227 100644 --- a/src/cesspool.c +++ b/src/cesspool.c @@ -1 +1,3 @@ // hyperswarm dht +#include "cesspool.h" +#include "s7.h" diff --git a/src/dat_net.c b/src/dat_net.c index e69de29..c60ac99 100644 --- a/src/dat_net.c +++ b/src/dat_net.c @@ -0,0 +1,4 @@ +// dat_net.c +#include "sleep.h" +#include "dat_net.h" +#include "cesspool.h"