mirror of
https://github.com/logos-storage/easylibstorage.git
synced 2026-02-09 11:23:06 +00:00
disable NAT for local example
This commit is contained in:
parent
847c3663fb
commit
a23a115b13
@ -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();
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user