Skip to content

Commit

Permalink
core/commands: remove 'ipfs dht' commands, except 'query'
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Feb 7, 2024
1 parent 80973d8 commit 1dfd491
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 202 deletions.
5 changes: 0 additions & 5 deletions core/commands/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,6 @@ func TestCommands(t *testing.T) {
"/dag/resolve",
"/dag/stat",
"/dht",
"/dht/findpeer",
"/dht/findprovs",
"/dht/get",
"/dht/provide",
"/dht/put",
"/dht/query",
"/routing",
"/routing/put",
Expand Down
57 changes: 1 addition & 56 deletions core/commands/dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,65 +21,10 @@ var DhtCmd = &cmds.Command{
},

Subcommands: map[string]*cmds.Command{
"query": queryDhtCmd,
"findprovs": findProvidersDhtCmd,
"findpeer": findPeerDhtCmd,
"get": getValueDhtCmd,
"put": putValueDhtCmd,
"provide": provideRefDhtCmd,
"query": queryDhtCmd,
},
}

var findProvidersDhtCmd = &cmds.Command{
Helptext: findProvidersRoutingCmd.Helptext,
Arguments: findProvidersRoutingCmd.Arguments,
Options: findProvidersRoutingCmd.Options,
Run: findProvidersRoutingCmd.Run,
Encoders: findProvidersRoutingCmd.Encoders,
Type: findProvidersRoutingCmd.Type,
Status: cmds.Deprecated,
}

var findPeerDhtCmd = &cmds.Command{
Helptext: findPeerRoutingCmd.Helptext,
Arguments: findPeerRoutingCmd.Arguments,
Options: findPeerRoutingCmd.Options,
Run: findPeerRoutingCmd.Run,
Encoders: findPeerRoutingCmd.Encoders,
Type: findPeerRoutingCmd.Type,
Status: cmds.Deprecated,
}

var getValueDhtCmd = &cmds.Command{
Helptext: getValueRoutingCmd.Helptext,
Arguments: getValueRoutingCmd.Arguments,
Options: getValueRoutingCmd.Options,
Run: getValueRoutingCmd.Run,
Encoders: getValueRoutingCmd.Encoders,
Type: getValueRoutingCmd.Type,
Status: cmds.Deprecated,
}

var putValueDhtCmd = &cmds.Command{
Helptext: putValueRoutingCmd.Helptext,
Arguments: putValueRoutingCmd.Arguments,
Options: putValueRoutingCmd.Options,
Run: putValueRoutingCmd.Run,
Encoders: putValueRoutingCmd.Encoders,
Type: putValueRoutingCmd.Type,
Status: cmds.Deprecated,
}

var provideRefDhtCmd = &cmds.Command{
Helptext: provideRefRoutingCmd.Helptext,
Arguments: provideRefRoutingCmd.Arguments,
Options: provideRefRoutingCmd.Options,
Run: provideRefRoutingCmd.Run,
Encoders: provideRefRoutingCmd.Encoders,
Type: provideRefRoutingCmd.Type,
Status: cmds.Deprecated,
}

// kademlia extends the routing interface with a command to get the peers closest to the target
type kademlia interface {
routing.Routing
Expand Down
7 changes: 6 additions & 1 deletion docs/changelogs/v0.27.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- [Gateway: support for `/api/v0` is deprecated](#gateway-support-for-apiv0-is-deprecated)
- [IPNS resolver cache's TTL can now be configured](#ipns-resolver-caches-ttl-can-now-be-configured)
- [RPC client: deprecated DHT API, added Routing API](#rpc-client-deprecated-dht-api-added-routing-api)
- [Deprecated DHT commands removed from `/api/v0/dht`](#deprecated-dht-commands-removed-from-apiv0dht)
- [📝 Changelog](#-changelog)
- [👨‍👩‍👧‍👦 Contributors](#-contributors)

Expand All @@ -28,10 +29,14 @@ You can now configure the upper-bound of a cached IPNS entry's Time-To-Live via

#### RPC client: deprecated DHT API, added Routing API

The RPC client now includes a Routing API to match the available commands in `/api/v0/routing`. In addition, the DHT API has been marked as deprecated.
The RPC client now includes a Routing API to match the available commands in `/api/v0/routing`. In addition, the DHT API has been marked as deprecated.

In the next version, all DHT deprecated methods will be removed from the Go RPC client.

#### Deprecated DHT commands removed from `/api/v0/dht`

All the DHT commands that were deprecated were finally removed from `/api/v0/dht`. You can now use them via `/api/v0/routing`.

### 📝 Changelog

### 👨‍👩‍👧‍👦 Contributors
2 changes: 1 addition & 1 deletion docs/file-transfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ In the case where node B simply cannot form a connection to node A, despite
knowing that it needs to, the likely culprit is a bad NAT. When node B learns
that it needs to connect to node A, it checks the DHT for addresses for node A,
and then starts trying to connect to them. We can check those addresses by
running `ipfs dht findpeer <node A peerID>` on node B. This command should
running `ipfs routing findpeer <node A peerID>` on node B. This command should
return a list of addresses for node A. If it doesn't return any addresses, then
you should try running the manual providing command from the previous steps.
Example output of addresses might look something like this:
Expand Down
2 changes: 0 additions & 2 deletions test/cli/basic_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ func TestCommandDocsWidth(t *testing.T) {
"ipfs pin remote rm": true,
"ipfs pin remote ls": true,
"ipfs pin verify": true,
"ipfs dht get": true,
"ipfs pin remote service add": true,
"ipfs pin update": true,
"ipfs pin rm": true,
Expand All @@ -167,7 +166,6 @@ func TestCommandDocsWidth(t *testing.T) {
"ipfs name": true,
"ipfs object patch append-data": true,
"ipfs object patch set-data": true,
"ipfs dht put": true,
"ipfs diag profile": true,
"ipfs diag cmds": true,
"ipfs swarm addrs local": true,
Expand Down
137 changes: 0 additions & 137 deletions test/cli/dht_legacy_test.go

This file was deleted.

0 comments on commit 1dfd491

Please sign in to comment.