diff --git a/core/commands/id.go b/core/commands/id.go index 0dc782d87..2b6f54c6d 100644 --- a/core/commands/id.go +++ b/core/commands/id.go @@ -36,6 +36,7 @@ type IdOutput struct { Addresses []string AgentVersion string ProtocolVersion string + Protocols []string } const ( @@ -123,6 +124,7 @@ EXAMPLE: output = strings.Replace(output, "", out.ProtocolVersion, -1) output = strings.Replace(output, "", out.PublicKey, -1) output = strings.Replace(output, "", strings.Join(out.Addresses, "\n"), -1) + output = strings.Replace(output, "", strings.Join(out.Protocols, "\n"), -1) output = strings.Replace(output, "\\n", "\n", -1) output = strings.Replace(output, "\\t", "\t", -1) fmt.Fprint(w, output) @@ -166,6 +168,11 @@ func printPeer(ps pstore.Peerstore, p peer.ID) (interface{}, error) { info.Addresses = append(info.Addresses, a.String()) } + protocols, _ := ps.GetProtocols(p) // don't care about errors here. + for _, p := range protocols { + info.Protocols = append(info.Protocols, string(p)) + } + if v, err := ps.Get(p, "ProtocolVersion"); err == nil { if vs, ok := v.(string); ok { info.ProtocolVersion = vs @@ -200,6 +207,7 @@ func printSelf(node *core.IpfsNode) (interface{}, error) { for _, a := range addrs { info.Addresses = append(info.Addresses, a.String()) } + info.Protocols = node.PeerHost.Mux().Protocols() } info.ProtocolVersion = identify.LibP2PVersion info.AgentVersion = version.UserAgent