You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
feat: enable DHT by Routing.Type config key (#3153)
Updates use of the kad-dht module in the codebase.
New features:
1. Adds [Routing.Type](https://github.com/ipfs/go-ipfs/blob/b86e93045aaa0ac357d939884e1c7996b0fcdbd4/docs/config.md#routing) configuration key with values
- `'none'` default, DHT disabled
- `'dht'` DHT start-as-client-auto-upgrade-to-server (not implemented in `js-libp2p-kad-dht` yet)
- `'dhtserver'` DHT server mode
- `'dhtclient'` DHT client mode
2. Updates Core API to be compliant with the docs
Co-authored-by: Jacob Heun <[email protected]>
Copy file name to clipboardExpand all lines: packages/ipfs/docs/DELEGATE_ROUTERS.md
+3
Original file line number
Diff line number
Diff line change
@@ -13,8 +13,11 @@ If you need to support Delegated Content and/or Peer Routing, you can enable it
13
13
If you are not able to run your own delegate router nodes, we currently have two nodes that support delegated routing. **Important**: As many people may be leveraging these nodes, performance may be affected, which is why we recommend running your own nodes in production.
14
14
15
15
Available delegate multiaddrs are:
16
+
16
17
-`/dns4/node0.delegate.ipfs.io/tcp/443/https`
17
18
-`/dns4/node1.delegate.ipfs.io/tcp/443/https`
19
+
-`/dns4/node2.delegate.ipfs.io/tcp/443/https`
20
+
-`/dns4/node3.delegate.ipfs.io/tcp/443/https`
18
21
19
22
**Note**: If more than 1 delegate multiaddr is specified, the actual delegate will be randomly selected on startup.
Copy file name to clipboardExpand all lines: packages/ipfs/docs/FAQ.md
+23-2
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
3
3
-[FAQ](#faq)
4
4
-[Why isn't there DHT support in js-IPFS?](#why-isnt-there-dht-support-in-js-ipfs)
5
+
-[Node.js](#nodejs)
6
+
-[Browser](#browser)
5
7
-[How to enable WebRTC support for js-ipfs in the Browser](#how-to-enable-webrtc-support-for-js-ipfs-in-the-browser)
6
8
-[Is there WebRTC support for js-ipfs with Node.js?](#is-there-webrtc-support-for-js-ipfs-with-nodejs)
7
9
-[How can I configure an IPFS node to use a custom `signaling endpoint` for my WebRTC transport?](#how-can-i-configure-an-ipfs-node-to-use-a-custom-signaling-endpoint-for-my-webrtc-transport)
@@ -13,7 +15,26 @@
13
15
14
16
There is DHT support for js-IPFS in the form of [libp2p/js-libp2p-kad-dht](https://github.com/libp2p/js-libp2p-kad-dht) but it is not finished yet, and may not be the right solution to the problem.
15
17
16
-
Historically js-IPFS has targeted browser environments. The constraints imposed by browsers do not typically make for good DHT participants - people do not tend to stay on a page for long enough to make or answer DHT queries, and even if they did, most nodes on the network talk TCP - the browser can neither open TCP ports on remote hosts nor accept TCP connections.
18
+
### Node.js
19
+
20
+
To enable DHT support, before starting your daemon run:
21
+
22
+
```console
23
+
$ jsipfs config Routing.Type dht
24
+
```
25
+
26
+
The possible values for `Routing.Type` are:
27
+
28
+
-`'none'` the default, this means the DHT is turned off any you must manually dial other nodes
29
+
-`'dht'` start the node in DHT client mode, if it is discovered to be publicly dialable it will automatically switch to server mode
30
+
-`'dhtclient'` A DHT client is able to make DHT queries but will not respond to any
31
+
-`'dhtserver'` A DHT server can make and respond to DHT queries. Please only choose this option if your node is dialable from the open Internet.
32
+
33
+
At the time of writing, only DHT client mode is supported and will be selected if `Routing.Type` is not `'none'`.
34
+
35
+
### Browser
36
+
37
+
In the browser there are many constraints that mean the environment does not typically make for good DHT participants - the number of connections required is high, people do not tend to stay on a page for long enough to make or answer DHT queries, and even if they did, most nodes on the network talk TCP - the browser can neither open TCP ports on remote hosts nor accept TCP connections.
17
38
18
39
A better approach may be to set up [Delegate Routing](./DELEGATE_ROUTERS.md) to use remote go-IPFS to make queries on the browsers' behalf as these do not have the same constraints.
19
40
@@ -122,4 +143,4 @@ Still if you run into problems with native modules follow these instructions [he
122
143
123
144
## Have more questions?
124
145
125
-
Ask for help in our forum at https://discuss.ipfs.io or in IRC (#ipfs on Freenode).
146
+
Ask for help in our forum at https://discuss.ipfs.io or in IRC (#ipfs on Freenode).
0 commit comments