Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit a0f424d

Browse files
vasco-santosAlan Shaw
and
Alan Shaw
committed
docs: add config file (#2256)
Co-Authored-By: Alan Shaw <[email protected]>
1 parent 109a436 commit a0f424d

File tree

2 files changed

+208
-1
lines changed

2 files changed

+208
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ Enable and configure experimental features.
338338
|------|---------|
339339
| object | [`config-nodejs.js`](https://github.com/ipfs/js-ipfs/tree/master/src/core/runtime/config-nodejs.js) in Node.js, [`config-browser.js`](https://github.com/ipfs/js-ipfs/tree/master/src/core/runtime/config-browser.js) in browsers |
340340
341-
Modify the default IPFS node config. This object will be *merged* with the default config; it will not replace it.
341+
Modify the default IPFS node config. This object will be *merged* with the default config; it will not replace it. The default config is documented in [the js-ipfs config file doc](doc/config.md).
342342
343343
###### Configuring Delegate Routers
344344

doc/config.md

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
# The js-ipfs config file
2+
3+
The js-ipfs config file is a JSON document located in the root directory of the js-ipfs repository.
4+
5+
## Table of Contents
6+
7+
- [`Addresses`](#addresses)
8+
- [`API`](#api)
9+
- [`Delegates`](#delegates)
10+
- [`Gateway`](#gateway)
11+
- [`Swarm`](#swarm)
12+
- [`Bootstrap`](#bootstrap)
13+
- [`Datastore`](#datastore)
14+
- [`Spec`](#spec)
15+
- [`Discovery`](#discovery)
16+
- [`MDNS`](#mdns)
17+
- [`webRTCStar`](#webrtcstar)
18+
- [`Identity`](#identity)
19+
- [`PeerID`](#peerid)
20+
- [`PrivKey`](#privkey)
21+
- [`Keychain`](#keychain)
22+
- [`Swarm`](#swarm)
23+
- [`ConnMgr`](#connmgr)
24+
25+
## `Addresses`
26+
Contains information about various listener addresses to be used by this node.
27+
28+
### `API`
29+
30+
The IPFS daemon exposes an HTTP API that allows to control the node and run the same commands as you can do from the command line. It is defined on the [HTTP API Spec](https://docs.ipfs.io/reference/api/http).
31+
32+
[Multiaddr](https://github.com/multiformats/multiaddr/) or array of [Multiaddr](https://github.com/multiformats/multiaddr/) describing the address(es) to serve the HTTP API on.
33+
34+
Default: `/ip4/127.0.0.1/tcp/5002`
35+
36+
### `Delegates`
37+
38+
Delegate peers are used to find peers and retrieve content from the network on your behalf.
39+
40+
Array of [Multiaddr](https://github.com/multiformats/multiaddr/) describing which addresses to use as delegate nodes.
41+
42+
Default: `[]`
43+
44+
### `Gateway`
45+
46+
A gateway is exposed by the IPFS daemon, which allows an easy way to access content from IPFS, using an IPFS path.
47+
48+
[Multiaddr](https://github.com/multiformats/multiaddr/) or array of [Multiaddr](https://github.com/multiformats/multiaddr/) describing the address(es) to serve the gateway on.
49+
50+
Default: `/ip4/127.0.0.1/tcp/9090`
51+
52+
### `Swarm`
53+
54+
Array of [Multiaddr](https://github.com/multiformats/multiaddr/) describing which addresses to listen on for p2p swarm connections.
55+
56+
Default:
57+
```json
58+
[
59+
"/ip4/0.0.0.0/tcp/4002",
60+
"/ip4/127.0.0.1/tcp/4003/ws"
61+
]
62+
```
63+
64+
## `Bootstrap`
65+
66+
Bootstrap is an array of [Multiaddr](https://github.com/multiformats/multiaddr/) of trusted nodes to connect to in order to
67+
initiate a connection to the network.
68+
69+
## `Datastore`
70+
71+
Contains information related to the construction and operation of the on-disk storage system.
72+
73+
### `Spec`
74+
75+
Spec defines the structure of the IPFS datastore. It is a composable structure, where each datastore is represented by a JSON object. Datastores can wrap other datastores to provide extra functionality (e.g. metrics, logging, or caching).
76+
77+
This can be changed manually, however, if you make any changes that require a different on-disk structure, you will need to run the [ipfs-ds-convert tool](https://github.com/ipfs/ipfs-ds-convert) to migrate data into the new structures.
78+
79+
Default:
80+
```json
81+
{
82+
"mounts": [
83+
{
84+
"child": {
85+
"path": "blocks",
86+
"shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
87+
"sync": true,
88+
"type": "flatfs"
89+
},
90+
"mountpoint": "/blocks",
91+
"prefix": "flatfs.datastore",
92+
"type": "measure"
93+
},
94+
{
95+
"child": {
96+
"compression": "none",
97+
"path": "datastore",
98+
"type": "levelds"
99+
},
100+
"mountpoint": "/",
101+
"prefix": "leveldb.datastore",
102+
"type": "measure"
103+
}
104+
],
105+
"type": "mount"
106+
}
107+
```
108+
109+
## `Discovery`
110+
111+
Contains options for configuring IPFS node discovery mechanisms.
112+
113+
### `MDNS`
114+
115+
Multicast DNS is a discovery protocol that is able to find other peers on the local network.
116+
117+
Options for Multicast DNS peer discovery:
118+
119+
- `Enabled`
120+
121+
A boolean value for whether or not MDNS should be active.
122+
123+
Default: `true`
124+
125+
- `Interval`
126+
127+
A number of seconds to wait between discovery checks.
128+
129+
Default: `10`
130+
131+
### `webRTCStar`
132+
133+
WebRTCStar is a discovery mechanism prvided by a signalling-star that allows peer-to-peer communications in the browser.
134+
135+
Options for webRTCstar peer discovery:
136+
137+
- `Enabled`
138+
139+
A boolean value for whether or not webRTCStar should be active.
140+
141+
Default: `true`
142+
143+
## `Identity`
144+
145+
### `PeerID`
146+
147+
The unique PKI identity label for this configs peer. Set on init and never read, its merely here for convenience. IPFS will always generate the peerID from its keypair at runtime.
148+
149+
### `PrivKey`
150+
151+
The base64 encoded protobuf describing (and containing) the nodes private key.
152+
153+
## `Keychain`
154+
155+
We can customize the key management and criptographically protected messages by changing the Keychain options. Those options are used for generating the derived encryption key (`DEK`). The `DEK` object, along with the passPhrase, is the input to a PBKDF2 function.
156+
157+
Default:
158+
```json
159+
{
160+
"dek": {
161+
"keyLength": 512/8,
162+
"iterationCount": 1000,
163+
"salt": "at least 16 characters long",
164+
"hash": "sha2-512"
165+
}
166+
}
167+
```
168+
169+
You can check the [parameter choice for pbkdf2](https://cryptosense.com/parameter-choice-for-pbkdf2/) for more information.
170+
171+
## `Swarm`
172+
173+
Options for configuring the swarm.
174+
175+
### `ConnMgr`
176+
177+
The connection manager determines which and how many connections to keep and can be configured to keep.
178+
179+
- `LowWater`
180+
181+
The minimum number of connections to maintain.
182+
183+
Default: `200` (both browser and node.js)
184+
185+
- `HighWater`
186+
187+
The number of connections that, when exceeded, will trigger a connection GC operation.
188+
189+
Default: `500` (both browser and node.js)
190+
191+
The "basic" connection manager tries to keep between `LowWater` and `HighWater` connections. It works by:
192+
193+
1. Keeping all connections until `HighWater` connections is reached.
194+
2. Once `HighWater` is reached, it closes connections until `LowWater` is reached.
195+
196+
**Example:**
197+
198+
```json
199+
{
200+
"Swarm": {
201+
"ConnMgr": {
202+
"LowWater": 100,
203+
"HighWater": 200,
204+
}
205+
}
206+
}
207+
```

0 commit comments

Comments
 (0)