1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-04 04:56:16 +08:00
Files
kubo/routing/none/none_client.go
Steven Allen 28be1d4c58 gx: update deps
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
2017-07-27 18:48:16 -07:00

55 lines
1.5 KiB
Go

package nilrouting
import (
"context"
"errors"
repo "github.com/ipfs/go-ipfs/repo"
pstore "gx/ipfs/QmPgDWmTmuzvP7QE5zwo1TmjbJme9pmZHNujB2453jkCTr/go-libp2p-peerstore"
routing "gx/ipfs/QmPjTrrSfE6TzLv6ya6VWhGcCgPrUAdcgrDcQyRDX2VyW1/go-libp2p-routing"
p2phost "gx/ipfs/QmRNyPNJGNCaZyYonJj7owciWTsMd9gRfEKmZY3o6xwN3h/go-libp2p-host"
cid "gx/ipfs/QmTprEaAA2A9bst5XH7exuyi5KzNMK3SEDNN8rBDnKWcUS/go-cid"
peer "gx/ipfs/QmXYjuNuxVzXKJCfWasQk1RqkhVLDM9jtUKhqc2WPQmFSB/go-libp2p-peer"
)
type nilclient struct {
}
func (c *nilclient) PutValue(_ context.Context, _ string, _ []byte) error {
return nil
}
func (c *nilclient) GetValue(_ context.Context, _ string) ([]byte, error) {
return nil, errors.New("Tried GetValue from nil routing.")
}
func (c *nilclient) GetValues(_ context.Context, _ string, _ int) ([]routing.RecvdVal, error) {
return nil, errors.New("Tried GetValues from nil routing.")
}
func (c *nilclient) FindPeer(_ context.Context, _ peer.ID) (pstore.PeerInfo, error) {
return pstore.PeerInfo{}, nil
}
func (c *nilclient) FindProvidersAsync(_ context.Context, _ *cid.Cid, _ int) <-chan pstore.PeerInfo {
out := make(chan pstore.PeerInfo)
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
}
func ConstructNilRouting(_ context.Context, _ p2phost.Host, _ repo.Datastore) (routing.IpfsRouting, error) {
return &nilclient{}, nil
}
// ensure nilclient satisfies interface
var _ routing.IpfsRouting = &nilclient{}