From 49cb135ca2906d101449f16577dfce80dc06cf29 Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Sun, 28 Dec 2014 06:25:45 -0800 Subject: [PATCH] ipfsnet -> swarmnet swarmnet is a better name for the package, because it's just a Network implemented with a Swarm. (ipfsnet will be something slightly different). --- core/core.go | 4 ++-- net/backpressure/backpressure_test.go | 2 +- net/services/identify/id_test.go | 2 +- net/services/relay/relay_test.go | 2 +- net/{ipfsnet => swarmnet}/net.go | 0 net/{ipfsnet => swarmnet}/net_test.go | 2 +- net/{ipfsnet => swarmnet}/util/util.go | 6 +++--- routing/dht/dht_test.go | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) rename net/{ipfsnet => swarmnet}/net.go (100%) rename net/{ipfsnet => swarmnet}/net_test.go (97%) rename net/{ipfsnet => swarmnet}/util/util.go (78%) diff --git a/core/core.go b/core/core.go index 41e974c30..3c581dc51 100644 --- a/core/core.go +++ b/core/core.go @@ -21,7 +21,7 @@ import ( merkledag "github.com/jbenet/go-ipfs/merkledag" namesys "github.com/jbenet/go-ipfs/namesys" inet "github.com/jbenet/go-ipfs/net" - ipfsnet "github.com/jbenet/go-ipfs/net/ipfsnet" + swarmnet "github.com/jbenet/go-ipfs/net/swarmnet" path "github.com/jbenet/go-ipfs/path" peer "github.com/jbenet/go-ipfs/peer" pin "github.com/jbenet/go-ipfs/pin" @@ -122,7 +122,7 @@ func NewIpfsNode(ctx context.Context, cfg *config.Config, online bool) (n *IpfsN return nil, debugerror.Wrap(err) } - n.Network, err = ipfsnet.NewNetwork(ctx, listenAddrs, n.Identity, n.Peerstore) + n.Network, err = swarmnet.NewNetwork(ctx, listenAddrs, n.Identity, n.Peerstore) if err != nil { return nil, debugerror.Wrap(err) } diff --git a/net/backpressure/backpressure_test.go b/net/backpressure/backpressure_test.go index 72e0b2634..3c988dd55 100644 --- a/net/backpressure/backpressure_test.go +++ b/net/backpressure/backpressure_test.go @@ -8,7 +8,7 @@ import ( "time" inet "github.com/jbenet/go-ipfs/net" - netutil "github.com/jbenet/go-ipfs/net/ipfsnet/util" + netutil "github.com/jbenet/go-ipfs/net/swarmnet/util" peer "github.com/jbenet/go-ipfs/peer" eventlog "github.com/jbenet/go-ipfs/util/eventlog" diff --git a/net/services/identify/id_test.go b/net/services/identify/id_test.go index 6583683a4..4d95407de 100644 --- a/net/services/identify/id_test.go +++ b/net/services/identify/id_test.go @@ -6,7 +6,7 @@ import ( inet "github.com/jbenet/go-ipfs/net" handshake "github.com/jbenet/go-ipfs/net/handshake" - netutil "github.com/jbenet/go-ipfs/net/ipfsnet/util" + netutil "github.com/jbenet/go-ipfs/net/swarmnet/util" peer "github.com/jbenet/go-ipfs/peer" context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context" diff --git a/net/services/relay/relay_test.go b/net/services/relay/relay_test.go index 57eee6db1..85b605534 100644 --- a/net/services/relay/relay_test.go +++ b/net/services/relay/relay_test.go @@ -5,9 +5,9 @@ import ( "testing" inet "github.com/jbenet/go-ipfs/net" - netutil "github.com/jbenet/go-ipfs/net/ipfsnet/util" mux "github.com/jbenet/go-ipfs/net/services/mux" relay "github.com/jbenet/go-ipfs/net/services/relay" + netutil "github.com/jbenet/go-ipfs/net/swarmnet/util" eventlog "github.com/jbenet/go-ipfs/util/eventlog" context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context" diff --git a/net/ipfsnet/net.go b/net/swarmnet/net.go similarity index 100% rename from net/ipfsnet/net.go rename to net/swarmnet/net.go diff --git a/net/ipfsnet/net_test.go b/net/swarmnet/net_test.go similarity index 97% rename from net/ipfsnet/net_test.go rename to net/swarmnet/net_test.go index 8cdd30f84..24f4c497c 100644 --- a/net/ipfsnet/net_test.go +++ b/net/swarmnet/net_test.go @@ -8,7 +8,7 @@ import ( context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context" inet "github.com/jbenet/go-ipfs/net" - netutil "github.com/jbenet/go-ipfs/net/ipfsnet/util" + netutil "github.com/jbenet/go-ipfs/net/swarmnet/util" ) // TestConnectednessCorrect starts a few networks, connects a few diff --git a/net/ipfsnet/util/util.go b/net/swarmnet/util/util.go similarity index 78% rename from net/ipfsnet/util/util.go rename to net/swarmnet/util/util.go index 6260cfc3f..a69e35499 100644 --- a/net/ipfsnet/util/util.go +++ b/net/swarmnet/util/util.go @@ -4,20 +4,20 @@ import ( "testing" inet "github.com/jbenet/go-ipfs/net" - in "github.com/jbenet/go-ipfs/net/ipfsnet" + sn "github.com/jbenet/go-ipfs/net/swarmnet" peer "github.com/jbenet/go-ipfs/peer" tu "github.com/jbenet/go-ipfs/util/testutil" context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context" ) -func GenNetwork(t *testing.T, ctx context.Context) *in.Network { +func GenNetwork(t *testing.T, ctx context.Context) *sn.Network { p := tu.RandPeerNetParamsOrFatal(t) ps := peer.NewPeerstore() ps.AddAddress(p.ID, p.Addr) ps.AddPubKey(p.ID, p.PubKey) ps.AddPrivKey(p.ID, p.PrivKey) - n, err := in.NewNetwork(ctx, ps.Addresses(p.ID), p.ID, ps) + n, err := sn.NewNetwork(ctx, ps.Addresses(p.ID), p.ID, ps) if err != nil { t.Fatal(err) } diff --git a/routing/dht/dht_test.go b/routing/dht/dht_test.go index 4e49b8f96..088dff217 100644 --- a/routing/dht/dht_test.go +++ b/routing/dht/dht_test.go @@ -14,7 +14,7 @@ import ( dssync "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync" ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr" - ipfsnet "github.com/jbenet/go-ipfs/net/ipfsnet" + swarmnet "github.com/jbenet/go-ipfs/net/swarmnet" peer "github.com/jbenet/go-ipfs/peer" routing "github.com/jbenet/go-ipfs/routing" u "github.com/jbenet/go-ipfs/util" @@ -49,7 +49,7 @@ func setupDHT(ctx context.Context, t *testing.T, addr ma.Multiaddr) *IpfsDHT { peerstore.AddPubKey(p, pk) peerstore.AddAddress(p, addr) - n, err := ipfsnet.NewNetwork(ctx, []ma.Multiaddr{addr}, p, peerstore) + n, err := swarmnet.NewNetwork(ctx, []ma.Multiaddr{addr}, p, peerstore) if err != nil { t.Fatal(err) }