Handling finding of peer via swarm
Also included is a way to pass port and swarm info to methods that build the config file. This makes testing easier. Multiple peers can be started on the same machine easily.
This commit is contained in:
parent
5d558f5229
commit
62096ffc1c
18 changed files with 210 additions and 42 deletions
|
@ -70,9 +70,11 @@ int config_path(char* config_root, char* extension, char* result, int max_len);
|
|||
* create a configuration based on the passed in parameters
|
||||
* @param config the configuration struct
|
||||
* @param num_bits_for_keypair number of bits for the key pair
|
||||
* @param swarm_port port for swarm
|
||||
* @param bootstrap_peers a vector of Multiaddress of fellow peers
|
||||
* @returns true(1) on success, otherwise 0
|
||||
*/
|
||||
int ipfs_repo_config_init(struct RepoConfig* config, unsigned int num_bits_for_keypair, const char* repo_path);
|
||||
int ipfs_repo_config_init(struct RepoConfig* config, unsigned int num_bits_for_keypair, const char* repo_path, int swarm_port, struct Libp2pVector *bootstrap_peers);
|
||||
|
||||
/***
|
||||
* Initialize memory for a RepoConfig struct
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
/***
|
||||
* Makes a new ipfs repository
|
||||
* @param path the path to the repository, should end
|
||||
* with .ipfs, and the directory should already exist.
|
||||
* @returns true(1) on success
|
||||
#include "libp2p/utils/vector.h"
|
||||
|
||||
/**
|
||||
* Make an IPFS directory at the passed in path
|
||||
* @param path the path
|
||||
* @param swarm_port the port that the swarm will run on
|
||||
* @param bootstrap_peers a Vector of MultiAddress of fellow peers
|
||||
* @param peer_id the peer id generated
|
||||
* @returns true(1) on success, false(0) on failure
|
||||
*/
|
||||
int make_ipfs_repository(const char* path);
|
||||
int make_ipfs_repository(const char* path, int swarm_port, struct Libp2pVector* bootstrap_peers, char **peer_id);
|
||||
|
||||
/**
|
||||
* Initialize a repository, called from the command line
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue