From a2a309d5d4a6844b8830b6e5dca8b0ae716608cf Mon Sep 17 00:00:00 2001 From: gammazero Date: Mon, 3 May 2021 09:08:16 -0700 Subject: [PATCH] Removed Peers from migration config --- migration.go | 5 ----- migration_test.go | 38 +------------------------------------- 2 files changed, 1 insertion(+), 42 deletions(-) diff --git a/migration.go b/migration.go index 24e92f7..27d4b3c 100644 --- a/migration.go +++ b/migration.go @@ -1,7 +1,5 @@ package config -import "github.com/libp2p/go-libp2p-core/peer" - const DefaultMigrationKeep = "cache" var DefaultMigrationDownloadSources = []string{"HTTPS", "IPFS"} @@ -16,7 +14,4 @@ type Migration struct { // Whether or not to keep the migration after downloading it. // Options are "discard", "cache", "pin". Empty string for default. Keep string - // Peers lists the nodes to attempt to connect with when downloading - // migrations. - Peers []peer.AddrInfo } diff --git a/migration_test.go b/migration_test.go index 47e2bed..a6cbd44 100644 --- a/migration_test.go +++ b/migration_test.go @@ -9,17 +9,7 @@ func TestMigrationDecode(t *testing.T) { str := ` { "DownloadSources": ["IPFS", "HTTP", "127.0.0.1"], - "Keep": "cache", - "Peers": [ - { - "ID": "12D3KooWGC6TvWhfapngX6wvJHMYvKpDMXPb3ZnCZ6dMoaMtimQ5", - "Addrs": ["/ip4/127.0.0.1/tcp/4001", "/ip4/127.0.0.1/udp/4001/quic"] - }, - { - "ID": "12D3KooWGC6TvWhfajpgX6wvJHMYvKpDMXPb3ZnCZ6dMoaMtimQ7", - "Addrs": ["/ip4/10.0.0.2/tcp/4001"] - } - ] + "Keep": "cache" } ` @@ -41,30 +31,4 @@ func TestMigrationDecode(t *testing.T) { if cfg.Keep != "cache" { t.Error("wrong value for Keep") } - - if len(cfg.Peers) != 2 { - t.Fatal("wrong number of peers") - } - - peer := cfg.Peers[0] - if peer.ID.String() != "12D3KooWGC6TvWhfapngX6wvJHMYvKpDMXPb3ZnCZ6dMoaMtimQ5" { - t.Errorf("wrong ID for first peer") - } - if len(peer.Addrs) != 2 { - t.Error("wrong number of addrs for first peer") - } - if peer.Addrs[0].String() != "/ip4/127.0.0.1/tcp/4001" { - t.Error("wrong first addr for first peer") - } - if peer.Addrs[1].String() != "/ip4/127.0.0.1/udp/4001/quic" { - t.Error("wrong second addr for first peer") - } - - peer = cfg.Peers[1] - if len(peer.Addrs) != 1 { - t.Fatal("wrong number of addrs for second peer") - } - if peer.Addrs[0].String() != "/ip4/10.0.0.2/tcp/4001" { - t.Error("wrong first addr for second peer") - } }