mirror of
https://github.com/fluencelabs/go-libp2p-kad-dht
synced 2025-04-24 22:32:13 +00:00
use stdlib context and clean up deps
This commit is contained in:
parent
c372d79e42
commit
e00b3ca0a4
2
dht.go
2
dht.go
@ -4,6 +4,7 @@ package dht
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
@ -28,7 +29,6 @@ import (
|
||||
host "github.com/libp2p/go-libp2p/p2p/host"
|
||||
protocol "github.com/libp2p/go-libp2p/p2p/protocol"
|
||||
base32 "github.com/whyrusleeping/base32"
|
||||
context "golang.org/x/net/context"
|
||||
)
|
||||
|
||||
var log = logging.Logger("dht")
|
||||
|
@ -3,6 +3,7 @@
|
||||
package dht
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
"sync"
|
||||
@ -13,7 +14,6 @@ import (
|
||||
goprocess "github.com/jbenet/goprocess"
|
||||
periodicproc "github.com/jbenet/goprocess/periodic"
|
||||
routing "github.com/libp2p/go-libp2p-routing"
|
||||
context "golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// BootstrapConfig specifies parameters used bootstrapping the DHT.
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dht
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
@ -8,10 +9,8 @@ import (
|
||||
ggio "github.com/gogo/protobuf/io"
|
||||
peer "github.com/ipfs/go-libp2p-peer"
|
||||
ctxio "github.com/jbenet/go-context/io"
|
||||
inet "github.com/libp2p/go-libp2p/p2p/net"
|
||||
context "golang.org/x/net/context"
|
||||
|
||||
pb "github.com/libp2p/go-libp2p-kad-dht/pb"
|
||||
inet "github.com/libp2p/go-libp2p/p2p/net"
|
||||
)
|
||||
|
||||
var dhtReadMessageTimeout = time.Minute
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dht
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"sort"
|
||||
@ -21,7 +22,6 @@ import (
|
||||
netutil "github.com/libp2p/go-libp2p/p2p/test/util"
|
||||
ci "github.com/libp2p/go-testutil/ci"
|
||||
travisci "github.com/libp2p/go-testutil/ci/travis"
|
||||
context "golang.org/x/net/context"
|
||||
)
|
||||
|
||||
var testCaseValues = map[string][]byte{}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dht
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"math/rand"
|
||||
"testing"
|
||||
@ -11,13 +12,11 @@ import (
|
||||
dssync "github.com/ipfs/go-datastore/sync"
|
||||
u "github.com/ipfs/go-ipfs-util"
|
||||
pstore "github.com/ipfs/go-libp2p-peerstore"
|
||||
pb "github.com/libp2p/go-libp2p-kad-dht/pb"
|
||||
record "github.com/libp2p/go-libp2p-record"
|
||||
routing "github.com/libp2p/go-libp2p-routing"
|
||||
inet "github.com/libp2p/go-libp2p/p2p/net"
|
||||
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
|
||||
context "golang.org/x/net/context"
|
||||
|
||||
pb "github.com/libp2p/go-libp2p-kad-dht/pb"
|
||||
)
|
||||
|
||||
func TestGetFailures(t *testing.T) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dht
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
@ -15,7 +16,6 @@ import (
|
||||
pb "github.com/libp2p/go-libp2p-kad-dht/pb"
|
||||
recpb "github.com/libp2p/go-libp2p-record/pb"
|
||||
base32 "github.com/whyrusleeping/base32"
|
||||
context "golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// The number of closer peers to send on requests.
|
||||
|
@ -1,13 +1,14 @@
|
||||
package dht
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
peer "github.com/ipfs/go-libp2p-peer"
|
||||
pset "github.com/ipfs/go-libp2p-peer/peerset"
|
||||
pstore "github.com/ipfs/go-libp2p-peerstore"
|
||||
logging "github.com/ipfs/go-log"
|
||||
kb "github.com/libp2p/go-libp2p-kbucket"
|
||||
notif "github.com/libp2p/go-libp2p-routing/notifications"
|
||||
context "golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// Required in order for proper JSON marshaling
|
||||
|
12
package.json
12
package.json
@ -24,11 +24,6 @@
|
||||
"name": "go-libp2p-peer",
|
||||
"version": "2.0.4"
|
||||
},
|
||||
{
|
||||
"hash": "QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt",
|
||||
"name": "go-net",
|
||||
"version": "0.0.0"
|
||||
},
|
||||
{
|
||||
"hash": "QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP",
|
||||
"name": "goprocess",
|
||||
@ -87,12 +82,6 @@
|
||||
"name": "bbloom",
|
||||
"version": "0.1.0"
|
||||
},
|
||||
{
|
||||
"author": "whyrusleeping",
|
||||
"hash": "Qmce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew",
|
||||
"name": "go-key",
|
||||
"version": "1.0.2"
|
||||
},
|
||||
{
|
||||
"author": "whyrusleeping",
|
||||
"hash": "QmYpVUnnedgGrp6cX2pBii5HRQgcSr778FiKVe7o7nF5Z3",
|
||||
@ -143,4 +132,3 @@
|
||||
"releaseCmd": "git commit -a -m \"gx publish $VERSION\"",
|
||||
"version": "1.2.0"
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
package dht_pb
|
||||
|
||||
import (
|
||||
key "github.com/ipfs/go-key"
|
||||
peer "github.com/ipfs/go-libp2p-peer"
|
||||
pstore "github.com/ipfs/go-libp2p-peerstore"
|
||||
logging "github.com/ipfs/go-log"
|
||||
b58 "github.com/jbenet/go-base58"
|
||||
ma "github.com/jbenet/go-multiaddr"
|
||||
inet "github.com/libp2p/go-libp2p/p2p/net"
|
||||
)
|
||||
@ -144,7 +144,7 @@ func (m *Message) Loggable() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"message": map[string]string{
|
||||
"type": m.Type.String(),
|
||||
"key": key.Key(m.GetKey()).B58String(),
|
||||
"key": b58.Encode([]byte(m.GetKey())),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package providers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"strings"
|
||||
@ -16,7 +17,6 @@ import (
|
||||
goprocessctx "github.com/jbenet/goprocess/context"
|
||||
autobatch "github.com/whyrusleeping/autobatch"
|
||||
base32 "github.com/whyrusleeping/base32"
|
||||
context "golang.org/x/net/context"
|
||||
)
|
||||
|
||||
var batchBufferSize = 256
|
||||
|
2
query.go
2
query.go
@ -1,6 +1,7 @@
|
||||
package dht
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
u "github.com/ipfs/go-ipfs-util"
|
||||
@ -14,7 +15,6 @@ import (
|
||||
ctxproc "github.com/jbenet/goprocess/context"
|
||||
routing "github.com/libp2p/go-libp2p-routing"
|
||||
notif "github.com/libp2p/go-libp2p-routing/notifications"
|
||||
context "golang.org/x/net/context"
|
||||
)
|
||||
|
||||
var maxQueryConcurrency = AlphaValue
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dht
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
@ -10,7 +11,6 @@ import (
|
||||
record "github.com/libp2p/go-libp2p-record"
|
||||
recpb "github.com/libp2p/go-libp2p-record/pb"
|
||||
routing "github.com/libp2p/go-libp2p-routing"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// MaxRecordAge specifies the maximum time that any node will hold onto a record
|
||||
|
@ -2,6 +2,7 @@ package dht
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"runtime"
|
||||
"sync"
|
||||
@ -17,7 +18,6 @@ import (
|
||||
routing "github.com/libp2p/go-libp2p-routing"
|
||||
notif "github.com/libp2p/go-libp2p-routing/notifications"
|
||||
inet "github.com/libp2p/go-libp2p/p2p/net"
|
||||
context "golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// asyncQueryBuffer is the size of buffered channels in async queries. This
|
||||
|
Loading…
x
Reference in New Issue
Block a user