1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-09 23:42:20 +08:00

wip with DHT

@whyrusleeping @jbenet this is a WIP with the DHT.

wip

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>

Conflicts:
	epictest/addcat_test.go
	exchange/bitswap/testnet/peernet.go
	exchange/bitswap/testutils.go
	routing/mock/centralized_server.go
	routing/mock/centralized_test.go
	routing/mock/interface.go

fix(routing/mock) fill in function definition
This commit is contained in:
Brian Tiger Chow
2014-12-17 10:02:19 -08:00
parent 14990bb556
commit ca32a83394
15 changed files with 127 additions and 68 deletions

View File

@ -5,9 +5,11 @@ import (
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
peer "github.com/jbenet/go-ipfs/peer"
routing "github.com/jbenet/go-ipfs/routing"
u "github.com/jbenet/go-ipfs/util"
"github.com/jbenet/go-ipfs/util/testutil"
)
var log = u.Logger("mockrouter")
@ -15,7 +17,7 @@ var log = u.Logger("mockrouter")
type client struct {
datastore ds.Datastore
server server
peer peer.PeerInfo
peer testutil.Peer
}
// FIXME(brian): is this method meant to simulate putting a value into the network?
@ -70,7 +72,11 @@ func (c *client) FindProvidersAsync(ctx context.Context, k u.Key, max int) <-cha
// Provide returns once the message is on the network. Value is not necessarily
// visible yet.
func (c *client) Provide(_ context.Context, key u.Key) error {
return c.server.Announce(c.peer, key)
info := peer.PeerInfo{
ID: c.peer.ID(),
Addrs: []ma.Multiaddr{c.peer.Address()},
}
return c.server.Announce(info, key)
}
var _ routing.IpfsRouting = &client{}