fix: sort protocols returned by ipfs id
Adin Schmahmann committed
Aug 8, 2020 at 21:38 UTC
d6b94360e2c7b63593e71775bc05a8c77268f82a
1 file changed
+3
core/commands/id.go
+3
@@ -6,6 +6,7 @@ import (
6
"errors"
7
"fmt"
8
"io"
9
+ "sort"
10
"strings"
11
12
version "github.com/ipfs/go-ipfs"
@@ -172,6 +173,7 @@ func printPeer(ps pstore.Peerstore, p peer.ID) (interface{}, error) {
173
for _, p := range protocols {
174
info.Protocols = append(info.Protocols, string(p))
175
}
176
+ sort.Strings(info.Protocols)
177
178
if v, err := ps.Get(p, "ProtocolVersion"); err == nil {
179
if vs, ok := v.(string); ok {
@@ -208,6 +210,7 @@ func printSelf(node *core.IpfsNode) (interface{}, error) {
210
info.Addresses = append(info.Addresses, a.String())
211
}
212
info.Protocols = node.PeerHost.Mux().Protocols()
213
+ sort.Strings(info.Protocols)
214
}
215
info.ProtocolVersion = identify.LibP2PVersion
216
info.AgentVersion = version.UserAgent