Unverified Commit 8920ecee authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #6872 from ipfs/fix/id-addr-format

fix: fix id addr format
parents f27d04fe 26c5e385
...@@ -14,6 +14,7 @@ import ( ...@@ -14,6 +14,7 @@ import (
cmds "github.com/ipfs/go-ipfs-cmds" cmds "github.com/ipfs/go-ipfs-cmds"
ic "github.com/libp2p/go-libp2p-core/crypto" ic "github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/host"
peer "github.com/libp2p/go-libp2p-core/peer" peer "github.com/libp2p/go-libp2p-core/peer"
pstore "github.com/libp2p/go-libp2p-core/peerstore" pstore "github.com/libp2p/go-libp2p-core/peerstore"
kb "github.com/libp2p/go-libp2p-kbucket" kb "github.com/libp2p/go-libp2p-kbucket"
...@@ -184,9 +185,12 @@ func printSelf(node *core.IpfsNode) (interface{}, error) { ...@@ -184,9 +185,12 @@ func printSelf(node *core.IpfsNode) (interface{}, error) {
info.PublicKey = base64.StdEncoding.EncodeToString(pkb) info.PublicKey = base64.StdEncoding.EncodeToString(pkb)
if node.PeerHost != nil { if node.PeerHost != nil {
for _, a := range node.PeerHost.Addrs() { addrs, err := peer.AddrInfoToP2pAddrs(host.InfoFromHost(node.PeerHost))
s := a.String() + "/ipfs/" + info.ID if err != nil {
info.Addresses = append(info.Addresses, s) return nil, err
}
for _, a := range addrs {
info.Addresses = append(info.Addresses, a.String())
} }
} }
info.ProtocolVersion = identify.LibP2PVersion info.ProtocolVersion = identify.LibP2PVersion
......
...@@ -298,10 +298,11 @@ var swarmAddrsLocalCmd = &cmds.Command{ ...@@ -298,10 +298,11 @@ var swarmAddrsLocalCmd = &cmds.Command{
} }
var addrs []string var addrs []string
p2pProtocolName := ma.ProtocolWithCode(ma.P_P2P).Name
for _, addr := range maddrs { for _, addr := range maddrs {
saddr := addr.String() saddr := addr.String()
if showid { if showid {
saddr = path.Join(saddr, "ipfs", self.ID().Pretty()) saddr = path.Join(saddr, p2pProtocolName, self.ID().Pretty())
} }
addrs = append(addrs, saddr) addrs = append(addrs, saddr)
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment