Skip to content

Commit d6b9436

Browse files
committed
fix: sort protocols returned by ipfs id
1 parent dd47364 commit d6b9436

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/commands/id.go

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"errors"
77
"fmt"
88
"io"
9+
"sort"
910
"strings"
1011

1112
version "github.com/ipfs/go-ipfs"
@@ -172,6 +173,7 @@ func printPeer(ps pstore.Peerstore, p peer.ID) (interface{}, error) {
172173
for _, p := range protocols {
173174
info.Protocols = append(info.Protocols, string(p))
174175
}
176+
sort.Strings(info.Protocols)
175177

176178
if v, err := ps.Get(p, "ProtocolVersion"); err == nil {
177179
if vs, ok := v.(string); ok {
@@ -208,6 +210,7 @@ func printSelf(node *core.IpfsNode) (interface{}, error) {
208210
info.Addresses = append(info.Addresses, a.String())
209211
}
210212
info.Protocols = node.PeerHost.Mux().Protocols()
213+
sort.Strings(info.Protocols)
211214
}
212215
info.ProtocolVersion = identify.LibP2PVersion
213216
info.AgentVersion = version.UserAgent

0 commit comments

Comments
 (0)