@cryptotaxi247 / kubo / commits / 3b5a6bda5

fix: fix id addr format

Instead of manually creating multiaddr strings, use the multiaddr logic to format them. We were still using `/ipfs` multiaddrs instead of `/p2p` multiaddrs.

Steven Allen committed Feb 5, 2020 at 07:39 UTC 3b5a6bda59ecc2954bb3d9f513876610e70b84ec
1 file changed +7 -3
core/commands/id.go
+7 -3
@@ -14,6 +14,7 @@ import (
14
15 cmds "github.com/ipfs/go-ipfs-cmds"
16 ic "github.com/libp2p/go-libp2p-core/crypto"
17 + "github.com/libp2p/go-libp2p-core/host"
18 peer "github.com/libp2p/go-libp2p-core/peer"
19 pstore "github.com/libp2p/go-libp2p-core/peerstore"
20 kb "github.com/libp2p/go-libp2p-kbucket"
@@ -184,9 +185,12 @@ func printSelf(node *core.IpfsNode) (interface{}, error) {
185 info.PublicKey = base64.StdEncoding.EncodeToString(pkb)
186
187 if node.PeerHost != nil {
187 - for _, a := range node.PeerHost.Addrs() {
188 - s := a.String() + "/ipfs/" + info.ID
189 - info.Addresses = append(info.Addresses, s)
188 + addrs, err := peer.AddrInfoToP2pAddrs(host.InfoFromHost(node.PeerHost))
189 + if err != nil {
190 + return nil, err
191 + }
192 + for _, a := range addrs {
193 + info.Addresses = append(info.Addresses, a.String())
194 }
195 }
196 info.ProtocolVersion = identify.LibP2PVersion