disable NAT for local example

This commit is contained in:
gmega 2026-01-30 18:12:31 -03:00
parent 847c3663fb
commit a23a115b13
No known key found for this signature in database
GPG Key ID: 6290D34EAD824B18
4 changed files with 10 additions and 5 deletions

View File

@ -142,8 +142,8 @@ STORAGE_NODE e_storage_new(node_config config) {
}
// Build JSON config string.
// Format: {"api-port":N,"disc-port":N,"data-dir":"...","log-level":"...","bootstrap-node":["..."]}
char json[2048];
// Format: {"api-port":N,"disc-port":N,"data-dir":"...","log-level":"...","bootstrap-node":["..."], "nat": "..."}
char json[3096];
int pos = 0;
pos += snprintf(json + pos, sizeof(json) - pos, "{\"api-port\":%d,\"disc-port\":%d", config.api_port,
@ -161,6 +161,10 @@ STORAGE_NODE e_storage_new(node_config config) {
pos += snprintf(json + pos, sizeof(json) - pos, ",\"bootstrap-node\":[\"%s\"]", config.bootstrap_node);
}
if (config.nat) {
pos += snprintf(json + pos, sizeof(json) - pos, ",\"nat\":\"%s\"", config.nat);
}
snprintf(json + pos, sizeof(json) - pos, "}");
resp *r = resp_alloc();

View File

@ -9,6 +9,7 @@ typedef struct {
char *data_dir;
char *log_level;
char *bootstrap_node;
char *nat;
} node_config;
typedef void (*progress_callback)(int total, int complete, int status);

View File

@ -19,6 +19,7 @@ int main(int argc, char *argv[]) {
.data_dir = "./downloader-data",
.log_level = "INFO",
.bootstrap_node = argv[1],
.nat = "none",
};
STORAGE_NODE node = e_storage_new(cfg);

View File

@ -19,6 +19,7 @@ int main(int argc, char *argv[]) {
.data_dir = "./uploader-data",
.log_level = "INFO",
.bootstrap_node = NULL,
.nat = "none",
};
STORAGE_NODE node = e_storage_new(cfg);
@ -27,9 +28,7 @@ int main(int argc, char *argv[]) {
char *cid = e_storage_upload(node, argv[1], progress);
char *spr = e_storage_spr(node);
printf("\nCID: %s\n", cid);
printf("SPR: %s\n", spr);
printf("Run: downloader %s %s ./output-file\n", spr, cid);
printf("\nPress Enter to exit\n");
getchar();