Repository: ipfs/boxo (language: go)

Issue:
Duplicated Nil router
There are at least two implementations of a router the does nothing:

The nil router at https://github.com/ipfs/boxo/blob/980447ea44a13729f1d6d72df9ce278608021277/routing/none/none_client.go#L49 (originally from https://github.com/ipfs/go-ipfs-routing)

The Null router at https://github.com/libp2p/go-libp2p-routing-helpers/blob/77f4db3a49f600dc6f61ae7550d1f77450334c84/null.go#L12

The latter seems like the better implementation in that it properly returns errors.

Some options for what to do here:
1. Remove the boxo version and put some info in the changelog
2. Deprecate the boxo version and delete it later
3. Stub out the nil router in boxo to just instantiate the version from go-libp2p-routing-helpers and deprecate + delete later
4. Bring the go-libp2p-routing-helpers into boxo and then break / deprecate the older version. While it could certainly live independently in practice a lot of the work on in practice I tend to see PRs to go-libp2p-routing-helpers mostly come alongside discovery of bugs, missing features, etc. needed by boxo so it might make maintainers' lives easier.

I don't see a ton of users of `ConstructNilRouting` so the removal is probably not that big a deal.


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f9e18769d..7ad3d652e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,8 @@ The following emojis are used to highlight certain changes:
 
 ### Removed
 
+* 🛠 `routing/none` removed `ConstructNilRouting`, if you need this functionality you can use the Null Router from [go-libp2p-routing-helpers](https://github.com/libp2p/go-libp2p-routing-helpers).
+
 ### Fixed
 
 ### Security
diff --git a/routing/none/none_client.go b/routing/none/none_client.go
deleted file mode 100644
index c8bcc1a3c..000000000
--- a/routing/none/none_client.go
+++ /dev/null
@@ -1,54 +0,0 @@
-// Package nilrouting implements a routing client that does nothing.
-package nilrouting
-
-import (
-	"context"
-	"errors"
-
-	"github.com/ipfs/go-cid"
-	ds "github.com/ipfs/go-datastore"
-	record "github.com/libp2p/go-libp2p-record"
-	"github.com/libp2p/go-libp2p/core/host"
-	"github.com/libp2p/go-libp2p/core/peer"
-	"github.com/libp2p/go-libp2p/core/routing"
-)
-
-type nilclient struct{}
-
-func (c *nilclient) PutValue(_ context.Context, _ string, _ []byte, _ ...routing.Option) error {
-	return nil
-}
-
-func (c *nilclient) GetValue(_ context.Context, _ string, _ ...routing.Option) ([]byte, error) {
-	return nil, errors.New("tried GetValue from nil routing")
-}
-
-func (c *nilclient) SearchValue(_ context.Context, _ string, _ ...routing.Option) (<-chan []byte, error) {
-	return nil, errors.New("tried SearchValue from nil routing")
-}
-
-func (c *nilclient) FindPeer(_ context.Context, _ peer.ID) (peer.AddrInfo, error) {
-	return peer.AddrInfo{}, nil
-}
-
-func (c *nilclient) FindProvidersAsync(_ context.Context, _ cid.Cid, _ int) <-chan peer.AddrInfo {
-	out := make(chan peer.AddrInfo)
-	defer close(out)
-	return out
-}
-
-func (c *nilclient) Provide(_ context.Context, _ cid.Cid, _ bool) error {
-	return nil
-}
-
-func (c *nilclient) Bootstrap(_ context.Context) error {
-	return nil
-}
-
-// ConstructNilRouting creates an Routing client which does nothing.
-func ConstructNilRouting(_ context.Context, _ host.Host, _ ds.Batching, _ record.Validator) (routing.Routing, error) {
-	return &nilclient{}, nil
-}
-
-// ensure nilclient satisfies interface
-var _ routing.Routing = &nilclient{}


Test patch: