Skip to content

Commit 8c6cee1

Browse files
authored
Merge pull request #115 from multiformats/feat/p2p-by-default
feat: switch to /p2p multiaddrs by default
2 parents 8f38850 + 438f18c commit 8c6cee1

File tree

3 files changed

+7
-18
lines changed

3 files changed

+7
-18
lines changed

multiaddr_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -509,8 +509,8 @@ func TestRoundTrip(t *testing.T) {
509509
"/ip4/127.0.0.1/tcp/123",
510510
"/ip4/127.0.0.1/udp/123",
511511
"/ip4/127.0.0.1/udp/123/ip6/::",
512-
"/ipfs/QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP",
513-
"/ipfs/QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP/unix/a/b/c",
512+
"/p2p/QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP",
513+
"/p2p/QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP/unix/a/b/c",
514514
} {
515515
ma, err := NewMultiaddr(s)
516516
if err != nil {
@@ -523,7 +523,6 @@ func TestRoundTrip(t *testing.T) {
523523
}
524524
}
525525

526-
// XXX: Change this test when we switch to /p2p by default.
527526
func TestIPFSvP2P(t *testing.T) {
528527
var (
529528
p2pAddr = "/p2p/QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP"
@@ -535,8 +534,8 @@ func TestIPFSvP2P(t *testing.T) {
535534
if err != nil {
536535
t.Errorf("error when parsing %q: %s", s, err)
537536
}
538-
if ma.String() != ipfsAddr {
539-
t.Errorf("expected %q, got %q", ipfsAddr, ma.String())
537+
if ma.String() != p2pAddr {
538+
t.Errorf("expected %q, got %q", p2pAddr, ma.String())
540539
}
541540
}
542541
}

protocol.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,9 @@ var Protocols = []Protocol{}
6262
// This will cause any P_P2P multiaddr to print out as /p2p/ instead of /ipfs/.
6363
// Note that the binary serialization of this multiaddr does not change at any
6464
// point. This means that this code is not a breaking network change at any point
65+
//
66+
// DEPRECATED: this is now the default
6567
func SwapToP2pMultiaddrs() {
66-
for i := range Protocols {
67-
if Protocols[i].Code == P_P2P {
68-
Protocols[i].Name = "p2p"
69-
break
70-
}
71-
}
72-
73-
protoP2P.Name = "p2p"
74-
75-
protocolsByName["ipfs"] = protoP2P
76-
protocolsByName["p2p"] = protoP2P
77-
protocolsByCode[protoP2P.Code] = protoP2P
7868
}
7969

8070
func AddProtocol(p Protocol) error {

protocols.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ var (
177177
VCode: CodeToVarint(P_HTTPS),
178178
}
179179
protoP2P = Protocol{
180-
Name: "ipfs",
180+
Name: "p2p",
181181
Code: P_P2P,
182182
VCode: CodeToVarint(P_P2P),
183183
Size: LengthPrefixedVarSize,

0 commit comments

Comments
 (0)