Skip to content

Commit 59b0ff1

Browse files
client optimizations
1 parent 9215300 commit 59b0ff1

File tree

1 file changed

+29
-15
lines changed

1 file changed

+29
-15
lines changed

src/routing/kad-dht.md

+29-15
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
title: Kademlia DHT
33
description: >
44
The IPFS Distributed Hash Table (DHT) specification defines a structured
5-
overlay network used for peer routing and content routing in the
6-
InterPlanetary File System (IPFS). It extends the libp2p Kademlia DHT
7-
specification, adapting and adding features to support IPFS-specific
8-
requirements.
5+
overlay network used for peer and content routing in the InterPlanetary File
6+
System (IPFS). It extends the libp2p Kademlia DHT specification, adapting and
7+
adding features to support IPFS-specific requirements.
98
date: 2025-03-18
109
maturity: reliable
1110
editors:
@@ -20,10 +19,9 @@ order: 1
2019
---
2120

2221
The IPFS Distributed Hash Table (DHT) specification defines a structured
23-
overlay network used for peer routing and content routing in the
24-
InterPlanetary File System (IPFS). It extends the libp2p Kademlia DHT
25-
specification, adapting and adding features to support IPFS-specific
26-
requirements.
22+
overlay network used for peer and content routing in the InterPlanetary File
23+
System (IPFS). It extends the libp2p Kademlia DHT specification, adapting and
24+
adding features to support IPFS-specific requirements.
2725

2826
## Introduction
2927

@@ -36,8 +34,8 @@ Goal of DHT is to find the closest peers to some key (in a specific geometry). O
3634
### DHT Operations
3735

3836
* Peer Routing
37+
* Content provider advertisement and discovery
3938
* Value storage and retrieval
40-
* Content provider advertisement and dsicovery
4139

4240
### Relation to [libp2p kad-dht](https://github.com/libp2p/specs/tree/master/kad-dht)
4341

@@ -58,7 +56,10 @@ used in other DHT swarms as well.
5856

5957
## DHT Swarms
6058

61-
A DHT swarm is a group of interconnected nodes running the IPFS Kademlia DHT protocol, collectively identified by a unique protocol identifier. IPFS nodes MAY participate in multiple DHT swarms simultaneously. DHT swarms can be either public or private.
59+
A DHT swarm is a group of interconnected nodes running the IPFS Kademlia DHT
60+
protocol, collectively identified by a unique protocol identifier. IPFS nodes
61+
MAY participate in multiple DHT swarms simultaneously. DHT swarms can be either
62+
public or private.
6263

6364
### Protocol Identifier
6465

@@ -639,13 +640,26 @@ TBD
639640

640641
### LAN DHT Swarms
641642

642-
Fine to store private multiaddresses in the routing table and serve them to
643-
other nodes in the same LAN DHT swarm.
643+
Implementations MAY support private or LAN-specific DHT swarms, which operate
644+
within a local network and remain isolated from the public DHT. Nodes MAY
645+
participate in multiple DHT swarms simultaneously, provided that each swarm has
646+
a unique protocol identifier.
644647

645-
### Checking peer behaviour before adding to routing table
648+
Private DHT swarms MAY store and serve private multiaddresses, as they are not
649+
exposed to the public network.
646650

647-
Make a `FIND_NODE` request and inspect response before adding node to RT.
648-
Followed https://blog.ipfs.tech/2023-ipfs-unresponsive-nodes/
651+
### Verifying DHT Server
652+
653+
Implementations MAY perform additional checks to ensure that DHT servers behave
654+
correctly before adding them to the routing table. In the past, misconfigured
655+
nodes have been added to routing tables, leading to [network
656+
slowdowns](https://blog.ipfs.tech/2023-ipfs-unresponsive-nodes/).
657+
658+
For example, kubo verifies a DHT server by sending a FIND_NODE request for its
659+
own Peer ID before adding it to the routing table
660+
([reference](https://github.com/libp2p/go-libp2p-kad-dht/blob/master/optimizations.md#checking-before-adding)).
661+
The server is only added if its response contains at least one peer. This check
662+
is skipped during the initial routing table setup.
649663

650664
## libp2p Kademlia DHT Implementations
651665

0 commit comments

Comments
 (0)