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
changed path parameter from {peer-id} to {key} to accept both CIDs and
Peer IDs, matching actual DHT usage where closest peers can be queried
for arbitrary keys
removed count and closer-than query parameters that were adding
complexity without clear use cases in practice
clarified response size should match DHT bucket size (20 for Amino DHT)
added note that this optional endpoint helps light clients lower the
cost of DHT walks in browser contexts
Copy file name to clipboardExpand all lines: src/routing/http-routing-v1.md
+8-11Lines changed: 8 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -246,19 +246,16 @@ The content body must be a [`application/vnd.ipfs.ipns-record`][application/vnd.
246
246
247
247
## DHT Routing API
248
248
249
-
### `GET /routing/v1/dht/closest/peers/{peer-id}`
249
+
### `GET /routing/v1/dht/closest/peers/{key}`
250
250
251
-
#### Path Parameters
252
-
253
-
-`peer-id` is a [Peer ID](https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md) represented as a CIDv1 encoded with `libp2p-key` codec.
251
+
This optional endpoint allows light clients to lower the cost of DHT walks in browser contexts.
254
252
255
-
#### Query Parameters
253
+
#### Path Parameters
256
254
257
-
-`closer-than` is an optional [Peer ID](https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md) represented as a CIDv1 encoded with `libp2p-key` codec.
258
-
- Returned peer records must be closer to `peer-id` than `closer-than`.
259
-
- If omitted the routing implementation should use its own [Peer ID](https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md).
260
-
-`count` is an optional number that specifies how many peer records the requester desires.
261
-
- Minimum 1, maximum 100, default 20.
255
+
-`key` is a [CID] or [Peer ID][peer-id-representation] to find the closest peers to.
256
+
-[CID] should be a CIDv1 in any encoding.
257
+
-[Peer ID][peer-id-representation] can be represented as a Multihash in Base58btc, or a CIDv1 with `libp2p-key` (`0x72`) codec in Base36 or Base32.
258
+
- Implementations SHOULD support both CID and Peer ID formats for maximum interoperability.
262
259
263
260
#### Response Status Codes
264
261
@@ -294,7 +291,7 @@ The content body must be a [`application/vnd.ipfs.ipns-record`][application/vnd.
294
291
}
295
292
```
296
293
297
-
The number of peer records in the responses SHOULD be limited to the `count` query parameter, which defaults to 20 if unspecified.
294
+
The number of peer records in the response SHOULD be limited to the DHT bucket size (20 for Amino DHT).
298
295
299
296
The client SHOULD be able to make a request with `Accept: application/x-ndjson` and get a [stream](#streaming) with more results.
0 commit comments