use stdlib context and clean up deps

This commit is contained in:
Jeromy 2016-09-30 10:24:03 -07:00
parent c372d79e42
commit e00b3ca0a4
13 changed files with 16 additions and 29 deletions

2
dht.go
View File

@ -4,6 +4,7 @@ package dht
import ( import (
"bytes" "bytes"
"context"
"errors" "errors"
"fmt" "fmt"
"sync" "sync"
@ -28,7 +29,6 @@ import (
host "github.com/libp2p/go-libp2p/p2p/host" host "github.com/libp2p/go-libp2p/p2p/host"
protocol "github.com/libp2p/go-libp2p/p2p/protocol" protocol "github.com/libp2p/go-libp2p/p2p/protocol"
base32 "github.com/whyrusleeping/base32" base32 "github.com/whyrusleeping/base32"
context "golang.org/x/net/context"
) )
var log = logging.Logger("dht") var log = logging.Logger("dht")

View File

@ -3,6 +3,7 @@
package dht package dht
import ( import (
"context"
"crypto/rand" "crypto/rand"
"fmt" "fmt"
"sync" "sync"
@ -13,7 +14,6 @@ import (
goprocess "github.com/jbenet/goprocess" goprocess "github.com/jbenet/goprocess"
periodicproc "github.com/jbenet/goprocess/periodic" periodicproc "github.com/jbenet/goprocess/periodic"
routing "github.com/libp2p/go-libp2p-routing" routing "github.com/libp2p/go-libp2p-routing"
context "golang.org/x/net/context"
) )
// BootstrapConfig specifies parameters used bootstrapping the DHT. // BootstrapConfig specifies parameters used bootstrapping the DHT.

View File

@ -1,6 +1,7 @@
package dht package dht
import ( import (
"context"
"fmt" "fmt"
"sync" "sync"
"time" "time"
@ -8,10 +9,8 @@ import (
ggio "github.com/gogo/protobuf/io" ggio "github.com/gogo/protobuf/io"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
ctxio "github.com/jbenet/go-context/io" 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" pb "github.com/libp2p/go-libp2p-kad-dht/pb"
inet "github.com/libp2p/go-libp2p/p2p/net"
) )
var dhtReadMessageTimeout = time.Minute var dhtReadMessageTimeout = time.Minute

View File

@ -1,6 +1,7 @@
package dht package dht
import ( import (
"context"
"fmt" "fmt"
"math/rand" "math/rand"
"sort" "sort"
@ -21,7 +22,6 @@ import (
netutil "github.com/libp2p/go-libp2p/p2p/test/util" netutil "github.com/libp2p/go-libp2p/p2p/test/util"
ci "github.com/libp2p/go-testutil/ci" ci "github.com/libp2p/go-testutil/ci"
travisci "github.com/libp2p/go-testutil/ci/travis" travisci "github.com/libp2p/go-testutil/ci/travis"
context "golang.org/x/net/context"
) )
var testCaseValues = map[string][]byte{} var testCaseValues = map[string][]byte{}

View File

@ -1,6 +1,7 @@
package dht package dht
import ( import (
"context"
"io" "io"
"math/rand" "math/rand"
"testing" "testing"
@ -11,13 +12,11 @@ import (
dssync "github.com/ipfs/go-datastore/sync" dssync "github.com/ipfs/go-datastore/sync"
u "github.com/ipfs/go-ipfs-util" u "github.com/ipfs/go-ipfs-util"
pstore "github.com/ipfs/go-libp2p-peerstore" pstore "github.com/ipfs/go-libp2p-peerstore"
pb "github.com/libp2p/go-libp2p-kad-dht/pb"
record "github.com/libp2p/go-libp2p-record" record "github.com/libp2p/go-libp2p-record"
routing "github.com/libp2p/go-libp2p-routing" routing "github.com/libp2p/go-libp2p-routing"
inet "github.com/libp2p/go-libp2p/p2p/net" inet "github.com/libp2p/go-libp2p/p2p/net"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock" 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) { func TestGetFailures(t *testing.T) {

View File

@ -1,6 +1,7 @@
package dht package dht
import ( import (
"context"
"errors" "errors"
"fmt" "fmt"
"time" "time"
@ -15,7 +16,6 @@ import (
pb "github.com/libp2p/go-libp2p-kad-dht/pb" pb "github.com/libp2p/go-libp2p-kad-dht/pb"
recpb "github.com/libp2p/go-libp2p-record/pb" recpb "github.com/libp2p/go-libp2p-record/pb"
base32 "github.com/whyrusleeping/base32" base32 "github.com/whyrusleeping/base32"
context "golang.org/x/net/context"
) )
// The number of closer peers to send on requests. // The number of closer peers to send on requests.

View File

@ -1,13 +1,14 @@
package dht package dht
import ( import (
"context"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
pset "github.com/ipfs/go-libp2p-peer/peerset" pset "github.com/ipfs/go-libp2p-peer/peerset"
pstore "github.com/ipfs/go-libp2p-peerstore" pstore "github.com/ipfs/go-libp2p-peerstore"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
kb "github.com/libp2p/go-libp2p-kbucket" kb "github.com/libp2p/go-libp2p-kbucket"
notif "github.com/libp2p/go-libp2p-routing/notifications" notif "github.com/libp2p/go-libp2p-routing/notifications"
context "golang.org/x/net/context"
) )
// Required in order for proper JSON marshaling // Required in order for proper JSON marshaling

View File

@ -24,11 +24,6 @@
"name": "go-libp2p-peer", "name": "go-libp2p-peer",
"version": "2.0.4" "version": "2.0.4"
}, },
{
"hash": "QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt",
"name": "go-net",
"version": "0.0.0"
},
{ {
"hash": "QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP", "hash": "QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP",
"name": "goprocess", "name": "goprocess",
@ -87,12 +82,6 @@
"name": "bbloom", "name": "bbloom",
"version": "0.1.0" "version": "0.1.0"
}, },
{
"author": "whyrusleeping",
"hash": "Qmce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew",
"name": "go-key",
"version": "1.0.2"
},
{ {
"author": "whyrusleeping", "author": "whyrusleeping",
"hash": "QmYpVUnnedgGrp6cX2pBii5HRQgcSr778FiKVe7o7nF5Z3", "hash": "QmYpVUnnedgGrp6cX2pBii5HRQgcSr778FiKVe7o7nF5Z3",
@ -143,4 +132,3 @@
"releaseCmd": "git commit -a -m \"gx publish $VERSION\"", "releaseCmd": "git commit -a -m \"gx publish $VERSION\"",
"version": "1.2.0" "version": "1.2.0"
} }

View File

@ -1,10 +1,10 @@
package dht_pb package dht_pb
import ( import (
key "github.com/ipfs/go-key"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
pstore "github.com/ipfs/go-libp2p-peerstore" pstore "github.com/ipfs/go-libp2p-peerstore"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
b58 "github.com/jbenet/go-base58"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
inet "github.com/libp2p/go-libp2p/p2p/net" inet "github.com/libp2p/go-libp2p/p2p/net"
) )
@ -144,7 +144,7 @@ func (m *Message) Loggable() map[string]interface{} {
return map[string]interface{}{ return map[string]interface{}{
"message": map[string]string{ "message": map[string]string{
"type": m.Type.String(), "type": m.Type.String(),
"key": key.Key(m.GetKey()).B58String(), "key": b58.Encode([]byte(m.GetKey())),
}, },
} }
} }

View File

@ -1,6 +1,7 @@
package providers package providers
import ( import (
"context"
"encoding/binary" "encoding/binary"
"fmt" "fmt"
"strings" "strings"
@ -16,7 +17,6 @@ import (
goprocessctx "github.com/jbenet/goprocess/context" goprocessctx "github.com/jbenet/goprocess/context"
autobatch "github.com/whyrusleeping/autobatch" autobatch "github.com/whyrusleeping/autobatch"
base32 "github.com/whyrusleeping/base32" base32 "github.com/whyrusleeping/base32"
context "golang.org/x/net/context"
) )
var batchBufferSize = 256 var batchBufferSize = 256

View File

@ -1,6 +1,7 @@
package dht package dht
import ( import (
"context"
"sync" "sync"
u "github.com/ipfs/go-ipfs-util" u "github.com/ipfs/go-ipfs-util"
@ -14,7 +15,6 @@ import (
ctxproc "github.com/jbenet/goprocess/context" ctxproc "github.com/jbenet/goprocess/context"
routing "github.com/libp2p/go-libp2p-routing" routing "github.com/libp2p/go-libp2p-routing"
notif "github.com/libp2p/go-libp2p-routing/notifications" notif "github.com/libp2p/go-libp2p-routing/notifications"
context "golang.org/x/net/context"
) )
var maxQueryConcurrency = AlphaValue var maxQueryConcurrency = AlphaValue

View File

@ -1,6 +1,7 @@
package dht package dht
import ( import (
"context"
"fmt" "fmt"
"time" "time"
@ -10,7 +11,6 @@ import (
record "github.com/libp2p/go-libp2p-record" record "github.com/libp2p/go-libp2p-record"
recpb "github.com/libp2p/go-libp2p-record/pb" recpb "github.com/libp2p/go-libp2p-record/pb"
routing "github.com/libp2p/go-libp2p-routing" 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 // MaxRecordAge specifies the maximum time that any node will hold onto a record

View File

@ -2,6 +2,7 @@ package dht
import ( import (
"bytes" "bytes"
"context"
"fmt" "fmt"
"runtime" "runtime"
"sync" "sync"
@ -17,7 +18,6 @@ import (
routing "github.com/libp2p/go-libp2p-routing" routing "github.com/libp2p/go-libp2p-routing"
notif "github.com/libp2p/go-libp2p-routing/notifications" notif "github.com/libp2p/go-libp2p-routing/notifications"
inet "github.com/libp2p/go-libp2p/p2p/net" 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 // asyncQueryBuffer is the size of buffered channels in async queries. This