Commit 4dd30d82 authored by Jeromy's avatar Jeromy
Browse files

switch to using stdlib context package

parent 87b0e200
package main package main
import ( import (
"context"
"flag" "flag"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
...@@ -17,7 +18,6 @@ import ( ...@@ -17,7 +18,6 @@ import (
testutil "github.com/libp2p/go-libp2p/testutil" testutil "github.com/libp2p/go-libp2p/testutil"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
context "golang.org/x/net/context"
) )
// create a 'Host' with a random peer to listen on the given address // create a 'Host' with a random peer to listen on the given address
......
package basichost package basichost
import ( import (
"context"
"io" "io"
"time" "time"
...@@ -15,7 +16,6 @@ import ( ...@@ -15,7 +16,6 @@ import (
protocol "github.com/libp2p/go-libp2p/p2p/protocol" protocol "github.com/libp2p/go-libp2p/p2p/protocol"
identify "github.com/libp2p/go-libp2p/p2p/protocol/identify" identify "github.com/libp2p/go-libp2p/p2p/protocol/identify"
relay "github.com/libp2p/go-libp2p/p2p/protocol/relay" relay "github.com/libp2p/go-libp2p/p2p/protocol/relay"
context "golang.org/x/net/context"
msmux "github.com/whyrusleeping/go-multistream" msmux "github.com/whyrusleeping/go-multistream"
) )
......
...@@ -2,6 +2,7 @@ package basichost_test ...@@ -2,6 +2,7 @@ package basichost_test
import ( import (
"bytes" "bytes"
"context"
"io" "io"
"testing" "testing"
"time" "time"
...@@ -10,8 +11,6 @@ import ( ...@@ -10,8 +11,6 @@ import (
inet "github.com/libp2p/go-libp2p/p2p/net" inet "github.com/libp2p/go-libp2p/p2p/net"
protocol "github.com/libp2p/go-libp2p/p2p/protocol" protocol "github.com/libp2p/go-libp2p/p2p/protocol"
testutil "github.com/libp2p/go-libp2p/p2p/test/util" testutil "github.com/libp2p/go-libp2p/p2p/test/util"
context "golang.org/x/net/context"
) )
func TestHostSimple(t *testing.T) { func TestHostSimple(t *testing.T) {
......
package basichost package basichost
import ( import (
"context"
"sync" "sync"
lgbl "github.com/ipfs/go-libp2p-loggables" lgbl "github.com/ipfs/go-libp2p-loggables"
...@@ -8,7 +9,6 @@ import ( ...@@ -8,7 +9,6 @@ import (
goprocess "github.com/jbenet/goprocess" goprocess "github.com/jbenet/goprocess"
inat "github.com/libp2p/go-libp2p/p2p/nat" inat "github.com/libp2p/go-libp2p/p2p/nat"
inet "github.com/libp2p/go-libp2p/p2p/net" inet "github.com/libp2p/go-libp2p/p2p/net"
context "golang.org/x/net/context"
) )
// natManager takes care of adding + removing port mappings to the nat. // natManager takes care of adding + removing port mappings to the nat.
......
package host package host
import ( import (
"context"
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"
...@@ -9,7 +11,6 @@ import ( ...@@ -9,7 +11,6 @@ import (
inet "github.com/libp2p/go-libp2p/p2p/net" inet "github.com/libp2p/go-libp2p/p2p/net"
protocol "github.com/libp2p/go-libp2p/p2p/protocol" protocol "github.com/libp2p/go-libp2p/p2p/protocol"
msmux "github.com/whyrusleeping/go-multistream" msmux "github.com/whyrusleeping/go-multistream"
context "golang.org/x/net/context"
) )
var log = logging.Logger("github.com/libp2p/go-libp2p/p2p/host") var log = logging.Logger("github.com/libp2p/go-libp2p/p2p/host")
......
package routedhost package routedhost
import ( import (
"context"
"fmt" "fmt"
"time" "time"
...@@ -13,7 +14,6 @@ import ( ...@@ -13,7 +14,6 @@ import (
metrics "github.com/libp2p/go-libp2p/p2p/metrics" metrics "github.com/libp2p/go-libp2p/p2p/metrics"
inet "github.com/libp2p/go-libp2p/p2p/net" inet "github.com/libp2p/go-libp2p/p2p/net"
protocol "github.com/libp2p/go-libp2p/p2p/protocol" protocol "github.com/libp2p/go-libp2p/p2p/protocol"
context "golang.org/x/net/context"
msmux "github.com/whyrusleeping/go-multistream" msmux "github.com/whyrusleeping/go-multistream"
) )
......
package conn package conn
import ( import (
"context"
"fmt" "fmt"
"io" "io"
"net" "net"
...@@ -14,7 +15,6 @@ import ( ...@@ -14,7 +15,6 @@ import (
mpool "github.com/jbenet/go-msgio/mpool" mpool "github.com/jbenet/go-msgio/mpool"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
manet "github.com/jbenet/go-multiaddr-net" manet "github.com/jbenet/go-multiaddr-net"
context "golang.org/x/net/context"
) )
var log = logging.Logger("conn") var log = logging.Logger("conn")
......
...@@ -8,9 +8,9 @@ import ( ...@@ -8,9 +8,9 @@ import (
"testing" "testing"
"time" "time"
"context"
msgio "github.com/jbenet/go-msgio" msgio "github.com/jbenet/go-msgio"
travis "github.com/libp2p/go-libp2p/testutil/ci/travis" travis "github.com/libp2p/go-libp2p/testutil/ci/travis"
context "golang.org/x/net/context"
) )
func msgioWrap(c Conn) msgio.ReadWriter { func msgioWrap(c Conn) msgio.ReadWriter {
......
...@@ -6,6 +6,7 @@ import ( ...@@ -6,6 +6,7 @@ import (
"strings" "strings"
"time" "time"
"context"
ci "github.com/ipfs/go-libp2p-crypto" ci "github.com/ipfs/go-libp2p-crypto"
lgbl "github.com/ipfs/go-libp2p-loggables" lgbl "github.com/ipfs/go-libp2p-loggables"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
...@@ -14,7 +15,6 @@ import ( ...@@ -14,7 +15,6 @@ import (
transport "github.com/libp2p/go-libp2p-transport" transport "github.com/libp2p/go-libp2p-transport"
addrutil "github.com/libp2p/go-libp2p/p2p/net/swarm/addr" addrutil "github.com/libp2p/go-libp2p/p2p/net/swarm/addr"
msmux "github.com/whyrusleeping/go-multistream" msmux "github.com/whyrusleeping/go-multistream"
context "golang.org/x/net/context"
) )
type WrapFunc func(transport.Conn) transport.Conn type WrapFunc func(transport.Conn) transport.Conn
......
...@@ -17,10 +17,10 @@ import ( ...@@ -17,10 +17,10 @@ import (
tu "github.com/libp2p/go-libp2p/testutil" tu "github.com/libp2p/go-libp2p/testutil"
tcpt "github.com/libp2p/go-tcp-transport" tcpt "github.com/libp2p/go-tcp-transport"
"context"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
msmux "github.com/whyrusleeping/go-multistream" msmux "github.com/whyrusleeping/go-multistream"
grc "github.com/whyrusleeping/gorocheck" grc "github.com/whyrusleeping/gorocheck"
context "golang.org/x/net/context"
) )
func goroFilter(r *grc.Goroutine) bool { func goroFilter(r *grc.Goroutine) bool {
......
package conn package conn
import ( import (
"context"
"fmt" "fmt"
"io" "io"
"net" "net"
...@@ -16,7 +17,6 @@ import ( ...@@ -16,7 +17,6 @@ import (
transport "github.com/libp2p/go-libp2p-transport" transport "github.com/libp2p/go-libp2p-transport"
filter "github.com/libp2p/go-libp2p/p2p/net/filter" filter "github.com/libp2p/go-libp2p/p2p/net/filter"
msmux "github.com/whyrusleeping/go-multistream" msmux "github.com/whyrusleeping/go-multistream"
context "golang.org/x/net/context"
) )
const ( const (
......
package conn package conn
import ( import (
"context"
"errors" "errors"
"net" "net"
"time" "time"
...@@ -9,7 +10,6 @@ import ( ...@@ -9,7 +10,6 @@ import (
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
secio "github.com/ipfs/go-libp2p-secio" secio "github.com/ipfs/go-libp2p-secio"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
context "golang.org/x/net/context"
) )
// secureConn wraps another Conn object with an encrypted channel. // secureConn wraps another Conn object with an encrypted channel.
......
...@@ -2,6 +2,7 @@ package conn ...@@ -2,6 +2,7 @@ package conn
import ( import (
"bytes" "bytes"
"context"
"runtime" "runtime"
"sync" "sync"
"testing" "testing"
...@@ -9,8 +10,6 @@ import ( ...@@ -9,8 +10,6 @@ import (
ic "github.com/ipfs/go-libp2p-crypto" ic "github.com/ipfs/go-libp2p-crypto"
travis "github.com/libp2p/go-libp2p/testutil/ci/travis" travis "github.com/libp2p/go-libp2p/testutil/ci/travis"
context "golang.org/x/net/context"
) )
func upgradeToSecureConn(t *testing.T, ctx context.Context, sk ic.PrivKey, c Conn) (Conn, error) { func upgradeToSecureConn(t *testing.T, ctx context.Context, sk ic.PrivKey, c Conn) (Conn, error) {
......
package net package net
import ( import (
"context"
"io" "io"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
...@@ -9,7 +10,6 @@ import ( ...@@ -9,7 +10,6 @@ import (
"github.com/jbenet/goprocess" "github.com/jbenet/goprocess"
conn "github.com/libp2p/go-libp2p/p2p/net/conn" conn "github.com/libp2p/go-libp2p/p2p/net/conn"
protocol "github.com/libp2p/go-libp2p/p2p/protocol" protocol "github.com/libp2p/go-libp2p/p2p/protocol"
context "golang.org/x/net/context"
) )
// MessageSizeMax is a soft (recommended) maximum for network messages. // MessageSizeMax is a soft (recommended) maximum for network messages.
......
package mocknet package mocknet
import ( import (
"context"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
context "golang.org/x/net/context"
) )
var log = logging.Logger("mocknet") var log = logging.Logger("mocknet")
......
...@@ -11,13 +11,13 @@ import ( ...@@ -11,13 +11,13 @@ import (
p2putil "github.com/libp2p/go-libp2p/p2p/test/util" p2putil "github.com/libp2p/go-libp2p/p2p/test/util"
testutil "github.com/libp2p/go-libp2p/testutil" testutil "github.com/libp2p/go-libp2p/testutil"
"context"
ic "github.com/ipfs/go-libp2p-crypto" ic "github.com/ipfs/go-libp2p-crypto"
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"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
"github.com/jbenet/goprocess" "github.com/jbenet/goprocess"
goprocessctx "github.com/jbenet/goprocess/context" goprocessctx "github.com/jbenet/goprocess/context"
context "golang.org/x/net/context"
) )
// mocknet implements mocknet.Mocknet // mocknet implements mocknet.Mocknet
......
package mocknet package mocknet
import ( import (
"context"
"testing" "testing"
"time" "time"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
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"
context "golang.org/x/net/context"
) )
func TestNotifications(t *testing.T) { func TestNotifications(t *testing.T) {
......
...@@ -7,12 +7,12 @@ import ( ...@@ -7,12 +7,12 @@ import (
inet "github.com/libp2p/go-libp2p/p2p/net" inet "github.com/libp2p/go-libp2p/p2p/net"
"context"
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"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
"github.com/jbenet/goprocess" "github.com/jbenet/goprocess"
goprocessctx "github.com/jbenet/goprocess/context" goprocessctx "github.com/jbenet/goprocess/context"
context "golang.org/x/net/context"
) )
// peernet implements inet.Network // peernet implements inet.Network
......
...@@ -14,8 +14,8 @@ import ( ...@@ -14,8 +14,8 @@ import (
protocol "github.com/libp2p/go-libp2p/p2p/protocol" protocol "github.com/libp2p/go-libp2p/p2p/protocol"
testutil "github.com/libp2p/go-libp2p/testutil" testutil "github.com/libp2p/go-libp2p/testutil"
"context"
detectrace "github.com/jbenet/go-detect-race" detectrace "github.com/jbenet/go-detect-race"
context "golang.org/x/net/context"
) )
func randPeer(t *testing.T) peer.ID { func randPeer(t *testing.T) peer.ID {
......
...@@ -3,10 +3,10 @@ package addrutil ...@@ -3,10 +3,10 @@ package addrutil
import ( import (
"fmt" "fmt"
"context"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
manet "github.com/jbenet/go-multiaddr-net" manet "github.com/jbenet/go-multiaddr-net"
context "golang.org/x/net/context"
_ "github.com/whyrusleeping/ws-transport" _ "github.com/whyrusleeping/ws-transport"
) )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment