Manipulates the
bootstrap list
, which contains the addresses of the bootstrap nodes. These are the trusted peers from which to learn about other peers in the network.
Only edit this list if you understand the risks of adding or removing nodes
Add a peer address to the bootstrap list
addr
is a multiaddr to a peer nodeoptions.default
if true, add the default peers to the list
Note: If passing the default
option, addr
is an optional parameter (may be undefined
/null
) and options may be passed as the first argument. i.e. ipfs.bootstrap.add({ default: true })
Returns
Type | Description |
---|---|
Promise<Object> |
An object that contains an array with all the added addresses |
example of the returned object:
{
Peers: [address1, address2, ...]
}
Example:
const validIp4 = '/ip4/104....9z'
const res = await ipfs.bootstrap.add(validIp4)
console.log(res.Peers)
// Logs:
// ['/ip4/104....9z']
A great source of examples can be found in the tests for this API.
List all peer addresses in the bootstrap list
Returns
Type | Description |
---|---|
Promise<Object> |
An object that contains an array with all the bootstrap addresses |
example of the returned object:
{
Peers: [address1, address2, ...]
}
Example:
const res = await ipfs.bootstrap.list()
console.log(res.Peers)
// Logs:
// [address1, address2, ...]
A great source of examples can be found in the tests for this API.
Remove a peer address from the bootstrap list
addr
is a multiaddr to a peer nodeoptions.all
if true, remove all peers from the list
Note: If passing the all
option, addr
is an optional parameter (may be undefined
/null
) and options may be passed as the first argument. i.e. ipfs.bootstrap.rm({ all: true })
Returns
Type | Description |
---|---|
Promise<Object> |
An object that contains an array with all the removed addresses |
{
Peers: [address1, address2, ...]
}
Example:
const res = await ipfs.bootstrap.rm(null, { all: true })
console.log(res.Peers)
// Logs:
// [address1, address2, ...]
A great source of examples can be found in the tests for this API.