Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3-routing
Commits
cbad7164
Commit
cbad7164
authored
Oct 05, 2016
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update to libp2p 4.0.1 and propogate other changes
License: MIT Signed-off-by:
Jeromy
<
why@ipfs.io
>
parent
f8c488ed
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
129 additions
and
124 deletions
+129
-124
mock/centralized_client.go
mock/centralized_client.go
+17
-16
mock/centralized_server.go
mock/centralized_server.go
+13
-10
mock/centralized_test.go
mock/centralized_test.go
+12
-10
mock/dht.go
mock/dht.go
+3
-3
mock/interface.go
mock/interface.go
+8
-7
none/none_client.go
none/none_client.go
+12
-11
offline/offline.go
offline/offline.go
+19
-18
supernode/client.go
supernode/client.go
+22
-22
supernode/proxy/loopback.go
supernode/proxy/loopback.go
+4
-4
supernode/proxy/standard.go
supernode/proxy/standard.go
+10
-14
supernode/server.go
supernode/server.go
+7
-7
supernode/server_test.go
supernode/server_test.go
+2
-2
No files found.
mock/centralized_client.go
View file @
cbad7164
package
mockrouting
import
(
"context"
"errors"
"time"
dshelp
"github.com/ipfs/go-ipfs/thirdparty/ds-help"
"github.com/ipfs/go-ipfs/thirdparty/testutil"
logging
"gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log"
peer
"gx/ipfs/Qm
WXjJo15p4pzT7cayEwZi2sWgJqLnGDof6ZGMh9xBgU1p/go-libp2p-pee
r"
pstore
"gx/ipfs/Qm
YkwVGkwoPbMVQEbf6LonZg4SsCxGP3H7PBEtdNCNRyxD
/go-libp2p-
peerstore
"
ma
"gx/ipfs/Qm
YzDkkgAEmrcNzFCiYo6L1dTX4EAG1gZkbtdbd9trL4vd/go-multiaddr
"
ma
"gx/ipfs/Qm
UAQaWbKxGCUTuoQVvvicbQNZ9APF5pDGWyAZSe93AtKH/go-multiadd
r"
routing
"gx/ipfs/Qm
XKuGUzLcgoQvp8M6ZEJzupWUNmx8NoqXEbYLMDjL4rjj
/go-libp2p-
routing
"
pstore
"gx/ipfs/Qm
XXCcQ7CLg5a81Ui9TTR35QcR4y7ZyihxwfjqaHfUVcVo/go-libp2p-peerstore
"
proto
"gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/proto"
u
"gx/ipfs/Qm
ZNVWh8LLjAavuQ2JXuFmuYH3C11xo988vSgp7UQrTRj1/go-ipfs-util
"
context
"gx/ipfs/Qm
Zy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context
"
cid
"gx/ipfs/Qm
akyCk6Vnn16WEKjbkxieZmM2YLTzkFWizbmGowoYPjro/go-cid
"
u
"gx/ipfs/Qm
b912gdngC1UWwTkhuW8knyRbcWeu5kqkxBpveLmW8bSr/go-ipfs-util
"
ds
"gx/ipfs/QmbzuUusHqaLLoNTDEVLcSF6vZDHZDLPC7p4bztRvvkXxU/go-datastore"
key
"gx/ipfs/Qmce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew/go-key"
dhtpb
"gx/ipfs/Qme7D9iKHYxwq28p6PzCymywsYSRBx9uyGzW7qNB3s9VbC/go-libp2p-record/pb"
routing
"gx/ipfs/QmemZcG8WprPbnVX3AM43GhhSUiA3V6NjcTLAguvWzkdpQ/go-libp2p-routing"
dhtpb
"gx/ipfs/QmdM4ohF7cr4MvAECVeD3hRA3HtZrk1ngaek4n8ojVT87h/go-libp2p-record/pb"
peer
"gx/ipfs/QmfMmLGoKzCHDN7cGgk64PJr4iipzidDRME8HABSJqvmhC/go-libp2p-peer"
)
var
log
=
logging
.
Logger
(
"mockrouter"
)
...
...
@@ -28,7 +29,7 @@ type client struct {
}
// FIXME(brian): is this method meant to simulate putting a value into the network?
func
(
c
*
client
)
PutValue
(
ctx
context
.
Context
,
key
key
.
Key
,
val
[]
byte
)
error
{
func
(
c
*
client
)
PutValue
(
ctx
context
.
Context
,
key
string
,
val
[]
byte
)
error
{
log
.
Debugf
(
"PutValue: %s"
,
key
)
rec
:=
new
(
dhtpb
.
Record
)
rec
.
Value
=
val
...
...
@@ -39,13 +40,13 @@ func (c *client) PutValue(ctx context.Context, key key.Key, val []byte) error {
return
err
}
return
c
.
datastore
.
Put
(
key
.
DsKey
(
),
data
)
return
c
.
datastore
.
Put
(
dshelp
.
NewKeyFromBinary
(
key
),
data
)
}
// FIXME(brian): is this method meant to simulate getting a value from the network?
func
(
c
*
client
)
GetValue
(
ctx
context
.
Context
,
key
key
.
Key
)
([]
byte
,
error
)
{
func
(
c
*
client
)
GetValue
(
ctx
context
.
Context
,
key
string
)
([]
byte
,
error
)
{
log
.
Debugf
(
"GetValue: %s"
,
key
)
v
,
err
:=
c
.
datastore
.
Get
(
key
.
DsKey
(
))
v
,
err
:=
c
.
datastore
.
Get
(
dshelp
.
NewKeyFromBinary
(
key
))
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -64,7 +65,7 @@ func (c *client) GetValue(ctx context.Context, key key.Key) ([]byte, error) {
return
rec
.
GetValue
(),
nil
}
func
(
c
*
client
)
GetValues
(
ctx
context
.
Context
,
key
key
.
Key
,
count
int
)
([]
routing
.
RecvdVal
,
error
)
{
func
(
c
*
client
)
GetValues
(
ctx
context
.
Context
,
key
string
,
count
int
)
([]
routing
.
RecvdVal
,
error
)
{
log
.
Debugf
(
"GetValues: %s"
,
key
)
data
,
err
:=
c
.
GetValue
(
ctx
,
key
)
if
err
!=
nil
{
...
...
@@ -74,7 +75,7 @@ func (c *client) GetValues(ctx context.Context, key key.Key, count int) ([]routi
return
[]
routing
.
RecvdVal
{{
Val
:
data
,
From
:
c
.
peer
.
ID
()}},
nil
}
func
(
c
*
client
)
FindProviders
(
ctx
context
.
Context
,
key
key
.
Key
)
([]
pstore
.
PeerInfo
,
error
)
{
func
(
c
*
client
)
FindProviders
(
ctx
context
.
Context
,
key
*
cid
.
Cid
)
([]
pstore
.
PeerInfo
,
error
)
{
return
c
.
server
.
Providers
(
key
),
nil
}
...
...
@@ -83,7 +84,7 @@ func (c *client) FindPeer(ctx context.Context, pid peer.ID) (pstore.PeerInfo, er
return
pstore
.
PeerInfo
{},
nil
}
func
(
c
*
client
)
FindProvidersAsync
(
ctx
context
.
Context
,
k
key
.
Key
,
max
int
)
<-
chan
pstore
.
PeerInfo
{
func
(
c
*
client
)
FindProvidersAsync
(
ctx
context
.
Context
,
k
*
cid
.
Cid
,
max
int
)
<-
chan
pstore
.
PeerInfo
{
out
:=
make
(
chan
pstore
.
PeerInfo
)
go
func
()
{
defer
close
(
out
)
...
...
@@ -103,7 +104,7 @@ func (c *client) FindProvidersAsync(ctx context.Context, k key.Key, max int) <-c
// Provide returns once the message is on the network. Value is not necessarily
// visible yet.
func
(
c
*
client
)
Provide
(
_
context
.
Context
,
key
key
.
Key
)
error
{
func
(
c
*
client
)
Provide
(
_
context
.
Context
,
key
*
cid
.
Cid
)
error
{
info
:=
pstore
.
PeerInfo
{
ID
:
c
.
peer
.
ID
(),
Addrs
:
[]
ma
.
Multiaddr
{
c
.
peer
.
Address
()},
...
...
mock/centralized_server.go
View file @
cbad7164
package
mockrouting
import
(
"context"
"math/rand"
"sync"
"time"
"github.com/ipfs/go-ipfs/thirdparty/testutil"
pstore
"gx/ipfs/QmXXCcQ7CLg5a81Ui9TTR35QcR4y7ZyihxwfjqaHfUVcVo/go-libp2p-peerstore"
cid
"gx/ipfs/QmakyCk6Vnn16WEKjbkxieZmM2YLTzkFWizbmGowoYPjro/go-cid"
ds
"gx/ipfs/QmbzuUusHqaLLoNTDEVLcSF6vZDHZDLPC7p4bztRvvkXxU/go-datastore"
dssync
"gx/ipfs/QmbzuUusHqaLLoNTDEVLcSF6vZDHZDLPC7p4bztRvvkXxU/go-datastore/sync"
key
"gx/ipfs/Qmce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew/go-key"
peer
"gx/ipfs/QmWXjJo15p4pzT7cayEwZi2sWgJqLnGDof6ZGMh9xBgU1p/go-libp2p-peer"
pstore
"gx/ipfs/QmYkwVGkwoPbMVQEbf6LonZg4SsCxGP3H7PBEtdNCNRyxD/go-libp2p-peerstore"
context
"gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
peer
"gx/ipfs/QmfMmLGoKzCHDN7cGgk64PJr4iipzidDRME8HABSJqvmhC/go-libp2p-peer"
)
// server is the mockrouting.Client's private interface to the routing server
type
server
interface
{
Announce
(
pstore
.
PeerInfo
,
key
.
Key
)
error
Providers
(
key
.
Key
)
[]
pstore
.
PeerInfo
Announce
(
pstore
.
PeerInfo
,
*
cid
.
Cid
)
error
Providers
(
*
cid
.
Cid
)
[]
pstore
.
PeerInfo
Server
}
...
...
@@ -28,7 +28,7 @@ type s struct {
delayConf
DelayConfig
lock
sync
.
RWMutex
providers
map
[
key
.
Key
]
map
[
peer
.
ID
]
providerRecord
providers
map
[
string
]
map
[
peer
.
ID
]
providerRecord
}
type
providerRecord
struct
{
...
...
@@ -36,10 +36,12 @@ type providerRecord struct {
Created
time
.
Time
}
func
(
rs
*
s
)
Announce
(
p
pstore
.
PeerInfo
,
k
key
.
Key
)
error
{
func
(
rs
*
s
)
Announce
(
p
pstore
.
PeerInfo
,
c
*
cid
.
Cid
)
error
{
rs
.
lock
.
Lock
()
defer
rs
.
lock
.
Unlock
()
k
:=
c
.
KeyString
()
_
,
ok
:=
rs
.
providers
[
k
]
if
!
ok
{
rs
.
providers
[
k
]
=
make
(
map
[
peer
.
ID
]
providerRecord
)
...
...
@@ -51,11 +53,12 @@ func (rs *s) Announce(p pstore.PeerInfo, k key.Key) error {
return
nil
}
func
(
rs
*
s
)
Providers
(
k
key
.
Key
)
[]
pstore
.
PeerInfo
{
func
(
rs
*
s
)
Providers
(
c
*
cid
.
Cid
)
[]
pstore
.
PeerInfo
{
rs
.
delayConf
.
Query
.
Wait
()
// before locking
rs
.
lock
.
RLock
()
defer
rs
.
lock
.
RUnlock
()
k
:=
c
.
KeyString
()
var
ret
[]
pstore
.
PeerInfo
records
,
ok
:=
rs
.
providers
[
k
]
...
...
mock/centralized_test.go
View file @
cbad7164
package
mockrouting
import
(
"context"
"testing"
"time"
delay
"github.com/ipfs/go-ipfs/thirdparty/delay"
"github.com/ipfs/go-ipfs/thirdparty/testutil"
key
"gx/ipfs/Qmce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew/go-key"
pstore
"gx/ipfs/QmYkwVGkwoPbMVQEbf6LonZg4SsCxGP3H7PBEtdNCNRyxD/go-libp2p-peerstore"
context
"gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
pstore
"gx/ipfs/QmXXCcQ7CLg5a81Ui9TTR35QcR4y7ZyihxwfjqaHfUVcVo/go-libp2p-peerstore"
cid
"gx/ipfs/QmakyCk6Vnn16WEKjbkxieZmM2YLTzkFWizbmGowoYPjro/go-cid"
u
"gx/ipfs/Qmb912gdngC1UWwTkhuW8knyRbcWeu5kqkxBpveLmW8bSr/go-ipfs-util"
)
func
TestKeyNotFound
(
t
*
testing
.
T
)
{
var
pi
=
testutil
.
RandIdentityOrFatal
(
t
)
var
key
=
key
.
Key
(
"mock key"
)
var
key
=
cid
.
NewCidV0
(
u
.
Hash
([]
byte
(
"mock key"
)
))
var
ctx
=
context
.
Background
()
rs
:=
NewServer
()
...
...
@@ -31,7 +32,7 @@ func TestClientFindProviders(t *testing.T) {
rs
:=
NewServer
()
client
:=
rs
.
Client
(
pi
)
k
:=
key
.
Key
(
"hello"
)
k
:=
cid
.
NewCidV0
(
u
.
Hash
([]
byte
(
"hello"
)
))
err
:=
client
.
Provide
(
context
.
Background
(),
k
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -41,7 +42,7 @@ func TestClientFindProviders(t *testing.T) {
time
.
Sleep
(
time
.
Millisecond
*
300
)
max
:=
100
providersFromClient
:=
client
.
FindProvidersAsync
(
context
.
Background
(),
k
ey
.
Key
(
"hello"
)
,
max
)
providersFromClient
:=
client
.
FindProvidersAsync
(
context
.
Background
(),
k
,
max
)
isInClient
:=
false
for
pi
:=
range
providersFromClient
{
if
pi
.
ID
==
pi
.
ID
{
...
...
@@ -55,7 +56,7 @@ func TestClientFindProviders(t *testing.T) {
func
TestClientOverMax
(
t
*
testing
.
T
)
{
rs
:=
NewServer
()
k
:=
key
.
Key
(
"hello"
)
k
:=
cid
.
NewCidV0
(
u
.
Hash
([]
byte
(
"hello"
)
))
numProvidersForHelloKey
:=
100
for
i
:=
0
;
i
<
numProvidersForHelloKey
;
i
++
{
pi
:=
testutil
.
RandIdentityOrFatal
(
t
)
...
...
@@ -82,7 +83,7 @@ func TestClientOverMax(t *testing.T) {
// TODO does dht ensure won't receive self as a provider? probably not.
func
TestCanceledContext
(
t
*
testing
.
T
)
{
rs
:=
NewServer
()
k
:=
key
.
Key
(
"hello"
)
k
:=
cid
.
NewCidV0
(
u
.
Hash
([]
byte
(
"hello"
)
))
// avoid leaking goroutine, without using the context to signal
// (we want the goroutine to keep trying to publish on a
...
...
@@ -138,10 +139,11 @@ func TestCanceledContext(t *testing.T) {
}
func
TestValidAfter
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
pi
:=
testutil
.
RandIdentityOrFatal
(
t
)
var
key
=
key
.
Key
(
"mock key"
)
var
ctx
=
context
.
Background
()
key
:=
cid
.
NewCidV0
(
u
.
Hash
([]
byte
(
"mock key"
)))
conf
:=
DelayConfig
{
ValueVisibility
:
delay
.
Fixed
(
1
*
time
.
Hour
),
Query
:
delay
.
Fixed
(
0
),
...
...
mock/dht.go
View file @
cbad7164
package
mockrouting
import
(
context
"context"
"github.com/ipfs/go-ipfs/thirdparty/testutil"
dht
"gx/ipfs/QmXVWh4XWRaRGdcGeFtBp3hx7H3mzYgVRpVN7LwtTaYv2E/go-libp2p-kad-dht"
context
"gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
mocknet
"gx/ipfs/QmbiRCGZqhfcSjnm9icGz3oNQQdPLAnLWnKHXixaEWXVCN/go-libp2p/p2p/net/mock"
dht
"gx/ipfs/QmRDMP3Y9E6hZtJwcFii8F6RTUSDn67Hi2o5VFTBXNRioo/go-libp2p-kad-dht"
ds
"gx/ipfs/QmbzuUusHqaLLoNTDEVLcSF6vZDHZDLPC7p4bztRvvkXxU/go-datastore"
sync
"gx/ipfs/QmbzuUusHqaLLoNTDEVLcSF6vZDHZDLPC7p4bztRvvkXxU/go-datastore/sync"
mocknet
"gx/ipfs/QmcRa2qn6iCmap9bjp8jAwkvYAq13AUfxdY3rrYiaJbLum/go-libp2p/p2p/net/mock"
)
type
mocknetserver
struct
{
...
...
mock/interface.go
View file @
cbad7164
...
...
@@ -5,15 +5,16 @@
package
mockrouting
import
(
"context"
delay
"github.com/ipfs/go-ipfs/thirdparty/delay"
"github.com/ipfs/go-ipfs/thirdparty/testutil"
peer
"gx/ipfs/Qm
WXjJo15p4pzT7cayEwZi2sWgJqLnGDof6ZGMh9xBgU1p
/go-libp2p-
peer
"
pstore
"gx/ipfs/Qm
YkwVGkwoPbMVQEbf6LonZg4SsCxGP3H7PBEtdNCNRyxD
/go-libp2p-peerstore"
c
ontext
"gx/ipfs/Qm
Zy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context
"
routing
"gx/ipfs/Qm
XKuGUzLcgoQvp8M6ZEJzupWUNmx8NoqXEbYLMDjL4rjj
/go-libp2p-
routing
"
pstore
"gx/ipfs/Qm
XXCcQ7CLg5a81Ui9TTR35QcR4y7ZyihxwfjqaHfUVcVo
/go-libp2p-peerstore"
c
id
"gx/ipfs/Qm
akyCk6Vnn16WEKjbkxieZmM2YLTzkFWizbmGowoYPjro/go-cid
"
ds
"gx/ipfs/QmbzuUusHqaLLoNTDEVLcSF6vZDHZDLPC7p4bztRvvkXxU/go-datastore"
key
"gx/ipfs/Qmce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew/go-key"
routing
"gx/ipfs/QmemZcG8WprPbnVX3AM43GhhSUiA3V6NjcTLAguvWzkdpQ/go-libp2p-routing"
peer
"gx/ipfs/QmfMmLGoKzCHDN7cGgk64PJr4iipzidDRME8HABSJqvmhC/go-libp2p-peer"
)
// Server provides mockrouting Clients
...
...
@@ -24,7 +25,7 @@ type Server interface {
// Client implements IpfsRouting
type
Client
interface
{
FindProviders
(
context
.
Context
,
key
.
Key
)
([]
pstore
.
PeerInfo
,
error
)
FindProviders
(
context
.
Context
,
*
cid
.
Cid
)
([]
pstore
.
PeerInfo
,
error
)
routing
.
IpfsRouting
}
...
...
@@ -39,7 +40,7 @@ func NewServer() Server {
// NewServerWithDelay returns a mockrouting Server with a delay!
func
NewServerWithDelay
(
conf
DelayConfig
)
Server
{
return
&
s
{
providers
:
make
(
map
[
key
.
Key
]
map
[
peer
.
ID
]
providerRecord
),
providers
:
make
(
map
[
string
]
map
[
peer
.
ID
]
providerRecord
),
delayConf
:
conf
,
}
}
...
...
none/none_client.go
View file @
cbad7164
package
nilrouting
import
(
"context"
"errors"
repo
"github.com/ipfs/go-ipfs/repo"
logging
"gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log"
peer
"gx/ipfs/QmWXjJo15p4pzT7cayEwZi2sWgJqLnGDof6ZGMh9xBgU1p/go-libp2p-peer"
pstore
"gx/ipfs/QmYkwVGkwoPbMVQEbf6LonZg4SsCxGP3H7PBEtdNCNRyxD/go-libp2p-peerstore"
context
"gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
p2phost
"gx/ipfs/QmbiRCGZqhfcSjnm9icGz3oNQQdPLAnLWnKHXixaEWXVCN/go-libp2p/p2p/host"
key
"gx/ipfs/Qmce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew/go-key"
routing
"gx/ipfs/QmemZcG8WprPbnVX3AM43GhhSUiA3V6NjcTLAguvWzkdpQ/go-libp2p-routing"
routing
"gx/ipfs/QmXKuGUzLcgoQvp8M6ZEJzupWUNmx8NoqXEbYLMDjL4rjj/go-libp2p-routing"
pstore
"gx/ipfs/QmXXCcQ7CLg5a81Ui9TTR35QcR4y7ZyihxwfjqaHfUVcVo/go-libp2p-peerstore"
cid
"gx/ipfs/QmakyCk6Vnn16WEKjbkxieZmM2YLTzkFWizbmGowoYPjro/go-cid"
p2phost
"gx/ipfs/QmdML3R42PRSwnt46jSuEts9bHSqLctVYEjJqMR3UYV8ki/go-libp2p-host"
peer
"gx/ipfs/QmfMmLGoKzCHDN7cGgk64PJr4iipzidDRME8HABSJqvmhC/go-libp2p-peer"
)
var
log
=
logging
.
Logger
(
"mockrouter"
)
...
...
@@ -18,15 +19,15 @@ var log = logging.Logger("mockrouter")
type
nilclient
struct
{
}
func
(
c
*
nilclient
)
PutValue
(
_
context
.
Context
,
_
key
.
Key
,
_
[]
byte
)
error
{
func
(
c
*
nilclient
)
PutValue
(
_
context
.
Context
,
_
string
,
_
[]
byte
)
error
{
return
nil
}
func
(
c
*
nilclient
)
GetValue
(
_
context
.
Context
,
_
key
.
Key
)
([]
byte
,
error
)
{
func
(
c
*
nilclient
)
GetValue
(
_
context
.
Context
,
_
string
)
([]
byte
,
error
)
{
return
nil
,
errors
.
New
(
"Tried GetValue from nil routing."
)
}
func
(
c
*
nilclient
)
GetValues
(
_
context
.
Context
,
_
key
.
Key
,
_
int
)
([]
routing
.
RecvdVal
,
error
)
{
func
(
c
*
nilclient
)
GetValues
(
_
context
.
Context
,
_
string
,
_
int
)
([]
routing
.
RecvdVal
,
error
)
{
return
nil
,
errors
.
New
(
"Tried GetValues from nil routing."
)
}
...
...
@@ -34,13 +35,13 @@ func (c *nilclient) FindPeer(_ context.Context, _ peer.ID) (pstore.PeerInfo, err
return
pstore
.
PeerInfo
{},
nil
}
func
(
c
*
nilclient
)
FindProvidersAsync
(
_
context
.
Context
,
_
key
.
Key
,
_
int
)
<-
chan
pstore
.
PeerInfo
{
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
,
_
key
.
Key
)
error
{
func
(
c
*
nilclient
)
Provide
(
_
context
.
Context
,
_
*
cid
.
Cid
)
error
{
return
nil
}
...
...
offline/offline.go
View file @
cbad7164
package
offline
import
(
"context"
"errors"
"time"
ds
"gx/ipfs/QmbzuUusHqaLLoNTDEVLcSF6vZDHZDLPC7p4bztRvvkXxU/go-datastore"
key
"gx/ipfs/Qmce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew/go-key"
record
"gx/ipfs/Qme7D9iKHYxwq28p6PzCymywsYSRBx9uyGzW7qNB3s9VbC/go-libp2p-record"
pb
"gx/ipfs/Qme7D9iKHYxwq28p6PzCymywsYSRBx9uyGzW7qNB3s9VbC/go-libp2p-record/pb"
routing
"gx/ipfs/QmemZcG8WprPbnVX3AM43GhhSUiA3V6NjcTLAguvWzkdpQ/go-libp2p-routing"
dshelp
"github.com/ipfs/go-ipfs/thirdparty/ds-help"
logging
"gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log"
ci
"gx/ipfs/QmVoi5es8D5fNHZDqoW6DgDAEPEV5hQp8GBz161vZXiwpQ/go-libp2p-crypto"
"gx/ipfs/QmWXjJo15p4pzT7cayEwZi2sWgJqLnGDof6ZGMh9xBgU1p/go-libp2p-peer"
pstore
"gx/ipfs/QmYkwVGkwoPbMVQEbf6LonZg4SsCxGP3H7PBEtdNCNRyxD/go-libp2p-peerstore"
routing
"gx/ipfs/QmXKuGUzLcgoQvp8M6ZEJzupWUNmx8NoqXEbYLMDjL4rjj/go-libp2p-routing"
pstore
"gx/ipfs/QmXXCcQ7CLg5a81Ui9TTR35QcR4y7ZyihxwfjqaHfUVcVo/go-libp2p-peerstore"
proto
"gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/proto"
context
"gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
cid
"gx/ipfs/QmakyCk6Vnn16WEKjbkxieZmM2YLTzkFWizbmGowoYPjro/go-cid"
ds
"gx/ipfs/QmbzuUusHqaLLoNTDEVLcSF6vZDHZDLPC7p4bztRvvkXxU/go-datastore"
record
"gx/ipfs/QmdM4ohF7cr4MvAECVeD3hRA3HtZrk1ngaek4n8ojVT87h/go-libp2p-record"
pb
"gx/ipfs/QmdM4ohF7cr4MvAECVeD3hRA3HtZrk1ngaek4n8ojVT87h/go-libp2p-record/pb"
"gx/ipfs/QmfMmLGoKzCHDN7cGgk64PJr4iipzidDRME8HABSJqvmhC/go-libp2p-peer"
ci
"gx/ipfs/QmfWDLQjGjVe4fr5CoztYW2DYYjRysMJrFe1RCsXLPTf46/go-libp2p-crypto"
)
var
log
=
logging
.
Logger
(
"offlinerouting"
)
...
...
@@ -37,7 +38,7 @@ type offlineRouting struct {
sk
ci
.
PrivKey
}
func
(
c
*
offlineRouting
)
PutValue
(
ctx
context
.
Context
,
key
key
.
Key
,
val
[]
byte
)
error
{
func
(
c
*
offlineRouting
)
PutValue
(
ctx
context
.
Context
,
key
string
,
val
[]
byte
)
error
{
rec
,
err
:=
record
.
MakePutRecord
(
c
.
sk
,
key
,
val
,
false
)
if
err
!=
nil
{
return
err
...
...
@@ -47,11 +48,11 @@ func (c *offlineRouting) PutValue(ctx context.Context, key key.Key, val []byte)
return
err
}
return
c
.
datastore
.
Put
(
key
.
DsKey
(
),
data
)
return
c
.
datastore
.
Put
(
dshelp
.
NewKeyFromBinary
(
key
),
data
)
}
func
(
c
*
offlineRouting
)
GetValue
(
ctx
context
.
Context
,
key
key
.
Key
)
([]
byte
,
error
)
{
v
,
err
:=
c
.
datastore
.
Get
(
key
.
DsKey
(
))
func
(
c
*
offlineRouting
)
GetValue
(
ctx
context
.
Context
,
key
string
)
([]
byte
,
error
)
{
v
,
err
:=
c
.
datastore
.
Get
(
dshelp
.
NewKeyFromBinary
(
key
))
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -69,8 +70,8 @@ func (c *offlineRouting) GetValue(ctx context.Context, key key.Key) ([]byte, err
return
rec
.
GetValue
(),
nil
}
func
(
c
*
offlineRouting
)
GetValues
(
ctx
context
.
Context
,
key
key
.
Key
,
_
int
)
([]
routing
.
RecvdVal
,
error
)
{
v
,
err
:=
c
.
datastore
.
Get
(
key
.
DsKey
(
))
func
(
c
*
offlineRouting
)
GetValues
(
ctx
context
.
Context
,
key
string
,
_
int
)
([]
routing
.
RecvdVal
,
error
)
{
v
,
err
:=
c
.
datastore
.
Get
(
dshelp
.
NewKeyFromBinary
(
key
))
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -90,7 +91,7 @@ func (c *offlineRouting) GetValues(ctx context.Context, key key.Key, _ int) ([]r
},
nil
}
func
(
c
*
offlineRouting
)
FindProviders
(
ctx
context
.
Context
,
key
key
.
Key
)
([]
pstore
.
PeerInfo
,
error
)
{
func
(
c
*
offlineRouting
)
FindProviders
(
ctx
context
.
Context
,
key
*
cid
.
Cid
)
([]
pstore
.
PeerInfo
,
error
)
{
return
nil
,
ErrOffline
}
...
...
@@ -98,13 +99,13 @@ func (c *offlineRouting) FindPeer(ctx context.Context, pid peer.ID) (pstore.Peer
return
pstore
.
PeerInfo
{},
ErrOffline
}
func
(
c
*
offlineRouting
)
FindProvidersAsync
(
ctx
context
.
Context
,
k
key
.
Key
,
max
int
)
<-
chan
pstore
.
PeerInfo
{
func
(
c
*
offlineRouting
)
FindProvidersAsync
(
ctx
context
.
Context
,
k
*
cid
.
Cid
,
max
int
)
<-
chan
pstore
.
PeerInfo
{
out
:=
make
(
chan
pstore
.
PeerInfo
)
close
(
out
)
return
out
}
func
(
c
*
offlineRouting
)
Provide
(
_
context
.
Context
,
k
ey
key
.
Key
)
error
{
func
(
c
*
offlineRouting
)
Provide
(
_
context
.
Context
,
k
*
cid
.
Cid
)
error
{
return
ErrOffline
}
...
...
supernode/client.go
View file @
cbad7164
...
...
@@ -2,22 +2,22 @@ package supernode
import
(
"bytes"
"context"
"errors"
"time"
proxy
"github.com/ipfs/go-ipfs/routing/supernode/proxy"
dhtpb
"gx/ipfs/QmRDMP3Y9E6hZtJwcFii8F6RTUSDn67Hi2o5VFTBXNRioo/go-libp2p-kad-dht/pb"
logging
"gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log"
peer
"gx/ipfs/QmWXjJo15p4pzT7cayEwZi2sWgJqLnGDof6ZGMh9xBgU1p/go-libp2p-peer"
dhtpb
"gx/ipfs/QmXVWh4XWRaRGdcGeFtBp3hx7H3mzYgVRpVN7LwtTaYv2E/go-libp2p-kad-dht/pb"
pstore
"gx/ipfs/QmYkwVGkwoPbMVQEbf6LonZg4SsCxGP3H7PBEtdNCNRyxD/go-libp2p-peerstore"
loggables
"gx/ipfs/QmYrv4LgCC8FhG2Ab4bwuq5DqBdwMtx3hMb3KKJDZcr2d7/go-libp2p-loggables"
loggables
"gx/ipfs/QmTMy4hVSY28DdwJ9kBz6y7q6MuioFzPcpM3Ma3aPjo1i3/go-libp2p-loggables"
routing
"gx/ipfs/QmXKuGUzLcgoQvp8M6ZEJzupWUNmx8NoqXEbYLMDjL4rjj/go-libp2p-routing"
pstore
"gx/ipfs/QmXXCcQ7CLg5a81Ui9TTR35QcR4y7ZyihxwfjqaHfUVcVo/go-libp2p-peerstore"
proto
"gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/proto"
context
"gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
"gx/ipfs/QmbiRCGZqhfcSjnm9icGz3oNQQdPLAnLWnKHXixaEWXVCN/go-libp2p/p2p/host"
key
"gx/ipfs/Qmce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew/go-key"
pb
"gx/ipfs/Qme7D9iKHYxwq28p6PzCymywsYSRBx9uyGzW7qNB3s9VbC/go-libp2p-record/pb"
routing
"gx/ipfs/QmemZcG8WprPbnVX3AM43GhhSUiA3V6NjcTLAguvWzkdpQ/go-libp2p-routing"
cid
"gx/ipfs/QmakyCk6Vnn16WEKjbkxieZmM2YLTzkFWizbmGowoYPjro/go-cid"
pb
"gx/ipfs/QmdM4ohF7cr4MvAECVeD3hRA3HtZrk1ngaek4n8ojVT87h/go-libp2p-record/pb"
"gx/ipfs/QmdML3R42PRSwnt46jSuEts9bHSqLctVYEjJqMR3UYV8ki/go-libp2p-host"
peer
"gx/ipfs/QmfMmLGoKzCHDN7cGgk64PJr4iipzidDRME8HABSJqvmhC/go-libp2p-peer"
)
var
log
=
logging
.
Logger
(
"supernode"
)
...
...
@@ -39,13 +39,13 @@ func NewClient(px proxy.Proxy, h host.Host, ps pstore.Peerstore, local peer.ID)
},
nil
}
func
(
c
*
Client
)
FindProvidersAsync
(
ctx
context
.
Context
,
k
key
.
Key
,
max
int
)
<-
chan
pstore
.
PeerInfo
{
func
(
c
*
Client
)
FindProvidersAsync
(
ctx
context
.
Context
,
k
*
cid
.
Cid
,
max
int
)
<-
chan
pstore
.
PeerInfo
{
logging
.
ContextWithLoggable
(
ctx
,
loggables
.
Uuid
(
"findProviders"
))
defer
log
.
EventBegin
(
ctx
,
"findProviders"
,
&
k
)
.
Done
()
defer
log
.
EventBegin
(
ctx
,
"findProviders"
,
k
)
.
Done
()
ch
:=
make
(
chan
pstore
.
PeerInfo
)
go
func
()
{
defer
close
(
ch
)
request
:=
dhtpb
.
NewMessage
(
dhtpb
.
Message_GET_PROVIDERS
,
s
tring
(
k
),
0
)
request
:=
dhtpb
.
NewMessage
(
dhtpb
.
Message_GET_PROVIDERS
,
k
.
KeyS
tring
(),
0
)
response
,
err
:=
c
.
proxy
.
SendRequest
(
ctx
,
request
)
if
err
!=
nil
{
log
.
Debug
(
err
)
...
...
@@ -63,8 +63,8 @@ func (c *Client) FindProvidersAsync(ctx context.Context, k key.Key, max int) <-c
return
ch
}
func
(
c
*
Client
)
PutValue
(
ctx
context
.
Context
,
k
key
.
Key
,
v
[]
byte
)
error
{
defer
log
.
EventBegin
(
ctx
,
"putValue"
,
&
k
)
.
Done
()
func
(
c
*
Client
)
PutValue
(
ctx
context
.
Context
,
k
string
,
v
[]
byte
)
error
{
defer
log
.
EventBegin
(
ctx
,
"putValue"
)
.
Done
()
r
,
err
:=
makeRecord
(
c
.
peerstore
,
c
.
local
,
k
,
v
)
if
err
!=
nil
{
return
err
...
...
@@ -74,8 +74,8 @@ func (c *Client) PutValue(ctx context.Context, k key.Key, v []byte) error {
return
c
.
proxy
.
SendMessage
(
ctx
,
pmes
)
// wrap to hide the remote
}
func
(
c
*
Client
)
GetValue
(
ctx
context
.
Context
,
k
key
.
Key
)
([]
byte
,
error
)
{
defer
log
.
EventBegin
(
ctx
,
"getValue"
,
&
k
)
.
Done
()
func
(
c
*
Client
)
GetValue
(
ctx
context
.
Context
,
k
string
)
([]
byte
,
error
)
{
defer
log
.
EventBegin
(
ctx
,
"getValue"
)
.
Done
()
msg
:=
dhtpb
.
NewMessage
(
dhtpb
.
Message_GET_VALUE
,
string
(
k
),
0
)
response
,
err
:=
c
.
proxy
.
SendRequest
(
ctx
,
msg
)
// TODO wrap to hide the remote
if
err
!=
nil
{
...
...
@@ -84,8 +84,8 @@ func (c *Client) GetValue(ctx context.Context, k key.Key) ([]byte, error) {
return
response
.
Record
.
GetValue
(),
nil
}
func
(
c
*
Client
)
GetValues
(
ctx
context
.
Context
,
k
key
.
Key
,
_
int
)
([]
routing
.
RecvdVal
,
error
)
{
defer
log
.
EventBegin
(
ctx
,
"getValue"
,
&
k
)
.
Done
()
func
(
c
*
Client
)
GetValues
(
ctx
context
.
Context
,
k
string
,
_
int
)
([]
routing
.
RecvdVal
,
error
)
{
defer
log
.
EventBegin
(
ctx
,
"getValue"
)
.
Done
()
msg
:=
dhtpb
.
NewMessage
(
dhtpb
.
Message_GET_VALUE
,
string
(
k
),
0
)
response
,
err
:=
c
.
proxy
.
SendRequest
(
ctx
,
msg
)
// TODO wrap to hide the remote
if
err
!=
nil
{
...
...
@@ -100,9 +100,9 @@ func (c *Client) GetValues(ctx context.Context, k key.Key, _ int) ([]routing.Rec
},
nil
}
func
(
c
*
Client
)
Provide
(
ctx
context
.
Context
,
k
key
.
Key
)
error
{
defer
log
.
EventBegin
(
ctx
,
"provide"
,
&
k
)
.
Done
()
msg
:=
dhtpb
.
NewMessage
(
dhtpb
.
Message_ADD_PROVIDER
,
s
tring
(
k
),
0
)
func
(
c
*
Client
)
Provide
(
ctx
context
.
Context
,
k
*
cid
.
Cid
)
error
{
defer
log
.
EventBegin
(
ctx
,
"provide"
,
k
)
.
Done
()
msg
:=
dhtpb
.
NewMessage
(
dhtpb
.
Message_ADD_PROVIDER
,
k
.
KeyS
tring
(),
0
)
// FIXME how is connectedness defined for the local node
pri
:=
[]
dhtpb
.
PeerRoutingInfo
{
{
...
...
@@ -132,7 +132,7 @@ func (c *Client) FindPeer(ctx context.Context, id peer.ID) (pstore.PeerInfo, err
}
// creates and signs a record for the given key/value pair
func
makeRecord
(
ps
pstore
.
Peerstore
,
p
peer
.
ID
,
k
key
.
Key
,
v
[]
byte
)
(
*
pb
.
Record
,
error
)
{
func
makeRecord
(
ps
pstore
.
Peerstore
,
p
peer
.
ID
,
k
string
,
v
[]
byte
)
(
*
pb
.
Record
,
error
)
{
blob
:=
bytes
.
Join
([][]
byte
{[]
byte
(
k
),
v
,
[]
byte
(
p
)},
[]
byte
{})
sig
,
err
:=
ps
.
PrivKey
(
p
)
.
Sign
(
blob
)
if
err
!=
nil
{
...
...
supernode/proxy/loopback.go
View file @
cbad7164
package
proxy
import
(
peer
"gx/ipfs/QmWXjJo15p4pzT7cayEwZi2sWgJqLnGDof6ZGMh9xBgU1p/go-libp2p-peer
"
dhtpb
"gx/ipfs/Qm
XVWh4XWRaRGdcGeFtBp3hx7H3mzYgVRpVN7LwtTaYv2E
/go-libp2p-kad-dht/pb"
context
"context
"
dhtpb
"gx/ipfs/Qm
RDMP3Y9E6hZtJwcFii8F6RTUSDn67Hi2o5VFTBXNRioo
/go-libp2p-kad-dht/pb"
ggio
"gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/io"
contex
t
"gx/ipfs/Qm
Zy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/contex
t"
inet
"gx/ipfs/Qm
biRCGZqhfcSjnm9icGz3oNQQdPLAnLWnKHXixaEWXVCN
/go-libp2p
/p2p/net
"
ine
t
"gx/ipfs/Qm
dXimY9QHaasZmw6hWojWnCJvfgxETjZQfg9g6ZrA9wMX/go-libp2p-ne
t"
peer
"gx/ipfs/Qm
fMmLGoKzCHDN7cGgk64PJr4iipzidDRME8HABSJqvmhC
/go-libp2p
-peer
"
)
// RequestHandler handles routing requests locally
...
...
supernode/proxy/standard.go
View file @
cbad7164
package
proxy
import
(
"context"
"errors"
ggio
"gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/io"
context
"gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
dhtpb
"gx/ipfs/QmRDMP3Y9E6hZtJwcFii8F6RTUSDn67Hi2o5VFTBXNRioo/go-libp2p-kad-dht/pb"
logging
"gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log"
peer
"gx/ipfs/QmWXjJo15p4pzT7cayEwZi2sWgJqLnGDof6ZGMh9xBgU1p/go-libp2p-peer"
pstore
"gx/ipfs/QmYkwVGkwoPbMVQEbf6LonZg4SsCxGP3H7PBEtdNCNRyxD/go-libp2p-peerstore"
host
"gx/ipfs/QmbiRCGZqhfcSjnm9icGz3oNQQdPLAnLWnKHXixaEWXVCN/go-libp2p/p2p/host"
inet
"gx/ipfs/QmbiRCGZqhfcSjnm9icGz3oNQQdPLAnLWnKHXixaEWXVCN/go-libp2p/p2p/net"
key
"gx/ipfs/Qmce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew/go-key"
kbucket
"gx/ipfs/QmVsCNFD32GzZ6Q5XD1TVGPRviNYqDdoNvgq853TU9hhzP/go-libp2p-kbucket"
dhtpb
"gx/ipfs/QmXVWh4XWRaRGdcGeFtBp3hx7H3mzYgVRpVN7LwtTaYv2E/go-libp2p-kad-dht/pb"
loggables
"gx/ipfs/QmYrv4LgCC8FhG2Ab4bwuq5DqBdwMtx3hMb3KKJDZcr2d7/go-libp2p-loggables"
loggables
"gx/ipfs/QmTMy4hVSY28DdwJ9kBz6y7q6MuioFzPcpM3Ma3aPjo1i3/go-libp2p-loggables"
kbucket
"gx/ipfs/QmUKePKcUEXwdvJENZJ6z8mJjPaxLsDZ3V9CZjPPtyawPm/go-libp2p-kbucket"
pstore
"gx/ipfs/QmXXCcQ7CLg5a81Ui9TTR35QcR4y7ZyihxwfjqaHfUVcVo/go-libp2p-peerstore"
ggio
"gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/io"
host
"gx/ipfs/QmdML3R42PRSwnt46jSuEts9bHSqLctVYEjJqMR3UYV8ki/go-libp2p-host"
inet
"gx/ipfs/QmdXimY9QHaasZmw6hWojWnCJvfgxETjZQfg9g6ZrA9wMX/go-libp2p-net"
peer
"gx/ipfs/QmfMmLGoKzCHDN7cGgk64PJr4iipzidDRME8HABSJqvmhC/go-libp2p-peer"
)
const
ProtocolSNR
=
"/ipfs/supernoderouting"
...
...
@@ -167,6 +163,6 @@ func (px *standard) sendRequest(ctx context.Context, m *dhtpb.Message, remote pe
}
func
sortedByKey
(
peers
[]
peer
.
ID
,
skey
string
)
[]
peer
.
ID
{
target
:=
kbucket
.
ConvertKey
(
key
.
Key
(
skey
)
)
target
:=
kbucket
.
ConvertKey
(
skey
)
return
kbucket
.
SortClosestPeers
(
peers
,
target
)
}
supernode/server.go
View file @
cbad7164
...
...
@@ -6,15 +6,15 @@ import (
proxy
"github.com/ipfs/go-ipfs/routing/supernode/proxy"
peer
"gx/ipfs/QmWXjJo15p4pzT7cayEwZi2sWgJqLnGDof6ZGMh9xBgU1p/go-libp2p-peer"
dhtpb
"gx/ipfs/QmXVWh4XWRaRGdcGeFtBp3hx7H3mzYgVRpVN7LwtTaYv2E/go-libp2p-kad-dht/pb"
pstore
"gx/ipfs/QmYkwVGkwoPbMVQEbf6LonZg4SsCxGP3H7PBEtdNCNRyxD/go-libp2p-peerstore"
context
"context"
dhtpb
"gx/ipfs/QmRDMP3Y9E6hZtJwcFii8F6RTUSDn67Hi2o5VFTBXNRioo/go-libp2p-kad-dht/pb"
pstore
"gx/ipfs/QmXXCcQ7CLg5a81Ui9TTR35QcR4y7ZyihxwfjqaHfUVcVo/go-libp2p-peerstore"
key
"gx/ipfs/QmYEoKZXHoAToWfhGF3vryhMn3WWhE1o2MasQ8uzY5iDi9/go-key"
proto
"gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/proto"
context
"gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
datastore
"gx/ipfs/QmbzuUusHqaLLoNTDEVLcSF6vZDHZDLPC7p4bztRvvkXxU/go-datastore"
key
"gx/ipfs/Qm
ce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew/go-key
"
record
"gx/ipfs/Qm
e7D9iKHYxwq28p6PzCymywsYSRBx9uyGzW7qNB3s9VbC
/go-libp2p-record"
p
b
"gx/ipfs/Qm
e7D9iKHYxwq28p6PzCymywsYSRBx9uyGzW7qNB3s9Vb
C/go-libp2p-
record/pb
"
record
"gx/ipfs/Qm
dM4ohF7cr4MvAECVeD3hRA3HtZrk1ngaek4n8ojVT87h/go-libp2p-record
"
pb
"gx/ipfs/Qm
dM4ohF7cr4MvAECVeD3hRA3HtZrk1ngaek4n8ojVT87h
/go-libp2p-record
/pb
"
p
eer
"gx/ipfs/Qm
fMmLGoKzCHDN7cGgk64PJr4iipzidDRME8HABSJqvmh
C/go-libp2p-
peer
"
)
// Server handles routing queries using a database backend
...
...
supernode/server_test.go
View file @
cbad7164
...
...
@@ -3,9 +3,9 @@ package supernode
import
(
"testing"
dhtpb
"gx/ipfs/QmXVWh4XWRaRGdcGeFtBp3hx7H3mzYgVRpVN7LwtTaYv2E/go-libp2p-kad-dht/pb"
dhtpb
"gx/ipfs/QmRDMP3Y9E6hZtJwcFii8F6RTUSDn67Hi2o5VFTBXNRioo/go-libp2p-kad-dht/pb"
key
"gx/ipfs/QmYEoKZXHoAToWfhGF3vryhMn3WWhE1o2MasQ8uzY5iDi9/go-key"
datastore
"gx/ipfs/QmbzuUusHqaLLoNTDEVLcSF6vZDHZDLPC7p4bztRvvkXxU/go-datastore"
key
"gx/ipfs/Qmce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew/go-key"
)
func
TestPutProviderDoesntResultInDuplicates
(
t
*
testing
.
T
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment