go-ipfs-config: Removed Peers from migration config
gammazero committed
May 3, 2021 at 09:08 UTC
4b778ce3267b6e5ce5f69cf57d1217218bdf01a4
2 files changed
+1
-42
config/migration.go
-5
@@ -1,7 +1,5 @@
1
package config
2
3
-import "github.com/libp2p/go-libp2p-core/peer"
4
-
3
const DefaultMigrationKeep = "cache"
4
5
var DefaultMigrationDownloadSources = []string{"HTTPS", "IPFS"}
@@ -16,7 +14,4 @@ type Migration struct {
14
// Whether or not to keep the migration after downloading it.
15
// Options are "discard", "cache", "pin". Empty string for default.
16
Keep string
19
- // Peers lists the nodes to attempt to connect with when downloading
20
- // migrations.
21
- Peers []peer.AddrInfo
17
}
config/migration_test.go
+1
-37
@@ -9,17 +9,7 @@ func TestMigrationDecode(t *testing.T) {
9
str := `
10
{
11
"DownloadSources": ["IPFS", "HTTP", "127.0.0.1"],
12
- "Keep": "cache",
13
- "Peers": [
14
- {
15
- "ID": "12D3KooWGC6TvWhfapngX6wvJHMYvKpDMXPb3ZnCZ6dMoaMtimQ5",
16
- "Addrs": ["/ip4/127.0.0.1/tcp/4001", "/ip4/127.0.0.1/udp/4001/quic"]
17
- },
18
- {
19
- "ID": "12D3KooWGC6TvWhfajpgX6wvJHMYvKpDMXPb3ZnCZ6dMoaMtimQ7",
20
- "Addrs": ["/ip4/10.0.0.2/tcp/4001"]
21
- }
22
- ]
12
+ "Keep": "cache"
13
}
14
`
15
@@ -41,30 +31,4 @@ func TestMigrationDecode(t *testing.T) {
31
if cfg.Keep != "cache" {
32
t.Error("wrong value for Keep")
33
}
44
-
45
- if len(cfg.Peers) != 2 {
46
- t.Fatal("wrong number of peers")
47
- }
48
-
49
- peer := cfg.Peers[0]
50
- if peer.ID.String() != "12D3KooWGC6TvWhfapngX6wvJHMYvKpDMXPb3ZnCZ6dMoaMtimQ5" {
51
- t.Errorf("wrong ID for first peer")
52
- }
53
- if len(peer.Addrs) != 2 {
54
- t.Error("wrong number of addrs for first peer")
55
- }
56
- if peer.Addrs[0].String() != "/ip4/127.0.0.1/tcp/4001" {
57
- t.Error("wrong first addr for first peer")
58
- }
59
- if peer.Addrs[1].String() != "/ip4/127.0.0.1/udp/4001/quic" {
60
- t.Error("wrong second addr for first peer")
61
- }
62
-
63
- peer = cfg.Peers[1]
64
- if len(peer.Addrs) != 1 {
65
- t.Fatal("wrong number of addrs for second peer")
66
- }
67
- if peer.Addrs[0].String() != "/ip4/10.0.0.2/tcp/4001" {
68
- t.Error("wrong first addr for second peer")
69
- }
34
}