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
p2p
go-p2p-kad-dht
Commits
a5e5c57f
Commit
a5e5c57f
authored
Jan 27, 2016
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial vendoring of libp2p outside of the repo with gx
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
b3564011
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
48 additions
and
48 deletions
+48
-48
dht.go
dht.go
+6
-6
dht_bootstrap.go
dht_bootstrap.go
+2
-2
dht_net.go
dht_net.go
+5
-5
dht_test.go
dht_test.go
+4
-4
diag.go
diag.go
+1
-1
ext_test.go
ext_test.go
+5
-5
handlers.go
handlers.go
+2
-2
lookup.go
lookup.go
+2
-2
notif.go
notif.go
+2
-2
pb/message.go
pb/message.go
+4
-4
providers.go
providers.go
+2
-2
providers_test.go
providers_test.go
+2
-2
query.go
query.go
+5
-5
records.go
records.go
+3
-3
routing.go
routing.go
+3
-3
No files found.
dht.go
View file @
a5e5c57f
...
...
@@ -10,21 +10,21 @@ import (
"time"
key
"github.com/ipfs/go-ipfs/blocks/key"
ci
"github.com/ipfs/go-ipfs/p2p/crypto"
host
"github.com/ipfs/go-ipfs/p2p/host"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
protocol
"github.com/ipfs/go-ipfs/p2p/protocol"
routing
"github.com/ipfs/go-ipfs/routing"
pb
"github.com/ipfs/go-ipfs/routing/dht/pb"
kb
"github.com/ipfs/go-ipfs/routing/kbucket"
record
"github.com/ipfs/go-ipfs/routing/record"
logging
"github.com/ipfs/go-ipfs/vendor/QmQg1J6vikuXF9oDvm4wpdeAUvvkVEKW1EYDw9HhTMnP2b/go-log"
logging
"gx/ipfs/QmaPaGNE2GqnfJjRRpQuQuFHuJn4FZvsrGxdik4kgxCkBi/go-log"
ci
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/crypto"
host
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/host"
peer
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/peer"
protocol
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/protocol"
proto
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
ds
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/ipfs/go-datastore"
goprocess
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess"
goprocessctx
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess/context"
context
"g
ithub.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/
net/context"
context
"g
x/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-
net/context"
)
var
log
=
logging
.
Logger
(
"dht"
)
...
...
dht_bootstrap.go
View file @
a5e5c57f
...
...
@@ -8,13 +8,13 @@ import (
"sync"
"time"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
routing
"github.com/ipfs/go-ipfs/routing"
u
"github.com/ipfs/go-ipfs/util"
peer
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/peer"
goprocess
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess"
periodicproc
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess/periodic"
context
"g
ithub.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/
net/context"
context
"g
x/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-
net/context"
)
// BootstrapConfig specifies parameters used bootstrapping the DHT.
...
...
dht_net.go
View file @
a5e5c57f
...
...
@@ -6,10 +6,10 @@ import (
ggio
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/gogo/protobuf/io"
ctxio
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-context/io"
context
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
inet
"github.com/ipfs/go-ipfs/p2p/net"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
context
"gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
pb
"github.com/ipfs/go-ipfs/routing/dht/pb"
inet
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/net"
peer
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/peer"
)
// handleNewStream implements the inet.StreamHandler
...
...
@@ -71,7 +71,7 @@ func (dht *IpfsDHT) handleNewMessage(s inet.Stream) {
func
(
dht
*
IpfsDHT
)
sendRequest
(
ctx
context
.
Context
,
p
peer
.
ID
,
pmes
*
pb
.
Message
)
(
*
pb
.
Message
,
error
)
{
log
.
Debugf
(
"%s dht starting stream"
,
dht
.
self
)
s
,
err
:=
dht
.
host
.
NewStream
(
ProtocolDHT
,
p
)
s
,
err
:=
dht
.
host
.
NewStream
(
ctx
,
ProtocolDHT
,
p
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -109,7 +109,7 @@ func (dht *IpfsDHT) sendRequest(ctx context.Context, p peer.ID, pmes *pb.Message
func
(
dht
*
IpfsDHT
)
sendMessage
(
ctx
context
.
Context
,
p
peer
.
ID
,
pmes
*
pb
.
Message
)
error
{
log
.
Debugf
(
"%s dht starting stream"
,
dht
.
self
)
s
,
err
:=
dht
.
host
.
NewStream
(
ProtocolDHT
,
p
)
s
,
err
:=
dht
.
host
.
NewStream
(
ctx
,
ProtocolDHT
,
p
)
if
err
!=
nil
{
return
err
}
...
...
dht_test.go
View file @
a5e5c57f
...
...
@@ -11,15 +11,15 @@ import (
ds
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/ipfs/go-datastore"
dssync
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/ipfs/go-datastore/sync"
ma
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr
"
context
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context
"
context
"gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context
"
ma
"gx/ipfs/QmR3JkmZBKYXgNMNsNZawm914455Qof3PEopwuVSeXG7aV/go-multiaddr
"
key
"github.com/ipfs/go-ipfs/blocks/key"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
netutil
"github.com/ipfs/go-ipfs/p2p/test/util"
routing
"github.com/ipfs/go-ipfs/routing"
record
"github.com/ipfs/go-ipfs/routing/record"
u
"github.com/ipfs/go-ipfs/util"
peer
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/peer"
netutil
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/test/util"
ci
"github.com/ipfs/go-ipfs/util/testutil/ci"
travisci
"github.com/ipfs/go-ipfs/util/testutil/ci/travis"
...
...
diag.go
View file @
a5e5c57f
...
...
@@ -4,7 +4,7 @@ import (
"encoding/json"
"time"
peer
"g
ithub.com/ipfs/go-ipfs
/p2p/peer"
peer
"g
x/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p
/p2p/peer"
)
type
connDiagInfo
struct
{
...
...
ext_test.go
View file @
a5e5c57f
...
...
@@ -10,16 +10,16 @@ import (
ggio
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/gogo/protobuf/io"
ds
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/ipfs/go-datastore"
dssync
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/ipfs/go-datastore/sync"
context
"g
ithub.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/
net/context"
context
"g
x/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-
net/context"
key
"github.com/ipfs/go-ipfs/blocks/key"
inet
"github.com/ipfs/go-ipfs/p2p/net"
mocknet
"github.com/ipfs/go-ipfs/p2p/net/mock"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
routing
"github.com/ipfs/go-ipfs/routing"
pb
"github.com/ipfs/go-ipfs/routing/dht/pb"
record
"github.com/ipfs/go-ipfs/routing/record"
u
"github.com/ipfs/go-ipfs/util"
inet
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/net"
mocknet
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/net/mock"
peer
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/peer"
)
func
TestGetFailures
(
t
*
testing
.
T
)
{
...
...
@@ -120,7 +120,7 @@ func TestGetFailures(t *testing.T) {
Record
:
rec
,
}
s
,
err
:=
hosts
[
1
]
.
NewStream
(
ProtocolDHT
,
hosts
[
0
]
.
ID
())
s
,
err
:=
hosts
[
1
]
.
NewStream
(
context
.
Background
(),
ProtocolDHT
,
hosts
[
0
]
.
ID
())
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
handlers.go
View file @
a5e5c57f
...
...
@@ -7,12 +7,12 @@ import (
proto
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
ds
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/ipfs/go-datastore"
context
"g
ithub.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/
net/context"
context
"g
x/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-
net/context"
key
"github.com/ipfs/go-ipfs/blocks/key"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
pb
"github.com/ipfs/go-ipfs/routing/dht/pb"
u
"github.com/ipfs/go-ipfs/util"
lgbl
"github.com/ipfs/go-ipfs/util/eventlog/loggables"
peer
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/peer"
)
// The number of closer peers to send on requests.
...
...
lookup.go
View file @
a5e5c57f
package
dht
import
(
context
"g
ithub.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/
net/context"
context
"g
x/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-
net/context"
key
"github.com/ipfs/go-ipfs/blocks/key"
notif
"github.com/ipfs/go-ipfs/notifications"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
kb
"github.com/ipfs/go-ipfs/routing/kbucket"
pset
"github.com/ipfs/go-ipfs/util/peerset"
peer
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/peer"
)
// Required in order for proper JSON marshaling
...
...
notif.go
View file @
a5e5c57f
package
dht
import
(
ma
"g
ithub.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet
/go-multiaddr"
ma
"g
x/ipfs/QmR3JkmZBKYXgNMNsNZawm914455Qof3PEopwuVSeXG7aV
/go-multiaddr"
inet
"g
ithub.com/ipfs/go-ipfs
/p2p/net"
inet
"g
x/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p
/p2p/net"
)
// netNotifiee defines methods to be used with the IpfsDHT
...
...
pb/message.go
View file @
a5e5c57f
package
dht_pb
import
(
ma
"g
ithub.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet
/go-multiaddr"
ma
"g
x/ipfs/QmR3JkmZBKYXgNMNsNZawm914455Qof3PEopwuVSeXG7aV
/go-multiaddr"
key
"github.com/ipfs/go-ipfs/blocks/key"
inet
"github.com/ipfs/go-ipfs/p2p/net
"
peer
"github.com/ipfs/go-ipfs
/p2p/
peer
"
logging
"github.com/ipfs/go-ipfs/vendor/QmQg1J6vikuXF9oDvm4wpdeAUvvkVEKW1EYDw9HhTMnP2b/go-log
"
logging
"gx/ipfs/QmaPaGNE2GqnfJjRRpQuQuFHuJn4FZvsrGxdik4kgxCkBi/go-log
"
inet
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p
/p2p/
net
"
peer
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/peer
"
)
var
log
=
logging
.
Logger
(
"dht.pb"
)
...
...
providers.go
View file @
a5e5c57f
...
...
@@ -6,9 +6,9 @@ import (
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess"
goprocessctx
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess/context"
key
"github.com/ipfs/go-ipfs/blocks/key"
peer
"g
ithub.com/ipfs/go-ipfs
/p2p/peer"
peer
"g
x/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p
/p2p/peer"
context
"g
ithub.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/
net/context"
context
"g
x/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-
net/context"
)
type
ProviderManager
struct
{
...
...
providers_test.go
View file @
a5e5c57f
...
...
@@ -4,9 +4,9 @@ import (
"testing"
key
"github.com/ipfs/go-ipfs/blocks/key"
peer
"g
ithub.com/ipfs/go-ipfs
/p2p/peer"
peer
"g
x/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p
/p2p/peer"
context
"g
ithub.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/
net/context"
context
"g
x/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-
net/context"
)
func
TestProviderManager
(
t
*
testing
.
T
)
{
...
...
query.go
View file @
a5e5c57f
...
...
@@ -5,17 +5,17 @@ import (
key
"github.com/ipfs/go-ipfs/blocks/key"
notif
"github.com/ipfs/go-ipfs/notifications"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
queue
"github.com/ipfs/go-ipfs/p2p/peer/queue"
"github.com/ipfs/go-ipfs/routing"
u
"github.com/ipfs/go-ipfs/util"
pset
"github.com/ipfs/go-ipfs/util/peerset"
todoctr
"github.com/ipfs/go-ipfs/util/todocounter"
logging
"github.com/ipfs/go-ipfs/vendor/QmQg1J6vikuXF9oDvm4wpdeAUvvkVEKW1EYDw9HhTMnP2b/go-log"
logging
"gx/ipfs/QmaPaGNE2GqnfJjRRpQuQuFHuJn4FZvsrGxdik4kgxCkBi/go-log"
peer
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/peer"
queue
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/peer/queue"
process
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess"
ctxproc
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess/context"
context
"g
ithub.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/
net/context"
context
"g
x/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-
net/context"
)
var
maxQueryConcurrency
=
AlphaValue
...
...
@@ -90,7 +90,7 @@ func newQueryRunner(q *dhtQuery) *dhtQueryRunner {
ctx
:=
ctxproc
.
OnClosingContext
(
proc
)
return
&
dhtQueryRunner
{
query
:
q
,
peersToQuery
:
queue
.
NewChanQueue
(
ctx
,
queue
.
NewXORDistancePQ
(
q
.
key
)),
peersToQuery
:
queue
.
NewChanQueue
(
ctx
,
queue
.
NewXORDistancePQ
(
string
(
q
.
key
))
)
,
peersRemaining
:
todoctr
.
NewSyncCounter
(),
peersSeen
:
pset
.
New
(),
rateLimit
:
make
(
chan
struct
{},
q
.
concurrency
),
...
...
records.go
View file @
a5e5c57f
...
...
@@ -5,12 +5,12 @@ import (
"time"
ctxfrac
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-context/frac"
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
ci
"github.com/ipfs/go-ipfs/p2p/crypto"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
"gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
routing
"github.com/ipfs/go-ipfs/routing"
pb
"github.com/ipfs/go-ipfs/routing/dht/pb"
record
"github.com/ipfs/go-ipfs/routing/record"
ci
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/crypto"
peer
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/peer"
)
// MaxRecordAge specifies the maximum time that any node will hold onto a record
...
...
routing.go
View file @
a5e5c57f
...
...
@@ -5,16 +5,16 @@ import (
"sync"
"time"
context
"g
ithub.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/
net/context"
context
"g
x/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-
net/context"
key
"github.com/ipfs/go-ipfs/blocks/key"
notif
"github.com/ipfs/go-ipfs/notifications"
inet
"github.com/ipfs/go-ipfs/p2p/net"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
"github.com/ipfs/go-ipfs/routing"
pb
"github.com/ipfs/go-ipfs/routing/dht/pb"
kb
"github.com/ipfs/go-ipfs/routing/kbucket"
record
"github.com/ipfs/go-ipfs/routing/record"
pset
"github.com/ipfs/go-ipfs/util/peerset"
inet
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/net"
peer
"gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/peer"
)
// asyncQueryBuffer is the size of buffered channels in async queries. This
...
...
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