Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mf
go-multiaddr
Commits
8c6cee15
Unverified
Commit
8c6cee15
authored
Dec 10, 2019
by
Steven Allen
Committed by
GitHub
Dec 10, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #115 from multiformats/feat/p2p-by-default
feat: switch to /p2p multiaddrs by default
parents
8f388501
438f18c3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
18 deletions
+7
-18
multiaddr_test.go
multiaddr_test.go
+4
-5
protocol.go
protocol.go
+2
-12
protocols.go
protocols.go
+1
-1
No files found.
multiaddr_test.go
View file @
8c6cee15
...
...
@@ -509,8 +509,8 @@ func TestRoundTrip(t *testing.T) {
"/ip4/127.0.0.1/tcp/123"
,
"/ip4/127.0.0.1/udp/123"
,
"/ip4/127.0.0.1/udp/123/ip6/::"
,
"/
ipfs
/QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP"
,
"/
ipfs
/QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP/unix/a/b/c"
,
"/
p2p
/QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP"
,
"/
p2p
/QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP/unix/a/b/c"
,
}
{
ma
,
err
:=
NewMultiaddr
(
s
)
if
err
!=
nil
{
...
...
@@ -523,7 +523,6 @@ func TestRoundTrip(t *testing.T) {
}
}
// XXX: Change this test when we switch to /p2p by default.
func
TestIPFSvP2P
(
t
*
testing
.
T
)
{
var
(
p2pAddr
=
"/p2p/QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP"
...
...
@@ -535,8 +534,8 @@ func TestIPFSvP2P(t *testing.T) {
if
err
!=
nil
{
t
.
Errorf
(
"error when parsing %q: %s"
,
s
,
err
)
}
if
ma
.
String
()
!=
ipfs
Addr
{
t
.
Errorf
(
"expected %q, got %q"
,
ipfs
Addr
,
ma
.
String
())
if
ma
.
String
()
!=
p2p
Addr
{
t
.
Errorf
(
"expected %q, got %q"
,
p2p
Addr
,
ma
.
String
())
}
}
}
...
...
protocol.go
View file @
8c6cee15
...
...
@@ -62,19 +62,9 @@ var Protocols = []Protocol{}
// This will cause any P_P2P multiaddr to print out as /p2p/ instead of /ipfs/.
// Note that the binary serialization of this multiaddr does not change at any
// point. This means that this code is not a breaking network change at any point
//
// DEPRECATED: this is now the default
func
SwapToP2pMultiaddrs
()
{
for
i
:=
range
Protocols
{
if
Protocols
[
i
]
.
Code
==
P_P2P
{
Protocols
[
i
]
.
Name
=
"p2p"
break
}
}
protoP2P
.
Name
=
"p2p"
protocolsByName
[
"ipfs"
]
=
protoP2P
protocolsByName
[
"p2p"
]
=
protoP2P
protocolsByCode
[
protoP2P
.
Code
]
=
protoP2P
}
func
AddProtocol
(
p
Protocol
)
error
{
...
...
protocols.go
View file @
8c6cee15
...
...
@@ -177,7 +177,7 @@ var (
VCode
:
CodeToVarint
(
P_HTTPS
),
}
protoP2P
=
Protocol
{
Name
:
"
ipfs
"
,
Name
:
"
p2p
"
,
Code
:
P_P2P
,
VCode
:
CodeToVarint
(
P_P2P
),
Size
:
LengthPrefixedVarSize
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment