File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import (
14
14
15
15
cmds "github.com/ipfs/go-ipfs-cmds"
16
16
ic "github.com/libp2p/go-libp2p-core/crypto"
17
+ "github.com/libp2p/go-libp2p-core/host"
17
18
peer "github.com/libp2p/go-libp2p-core/peer"
18
19
pstore "github.com/libp2p/go-libp2p-core/peerstore"
19
20
kb "github.com/libp2p/go-libp2p-kbucket"
@@ -184,9 +185,12 @@ func printSelf(node *core.IpfsNode) (interface{}, error) {
184
185
info .PublicKey = base64 .StdEncoding .EncodeToString (pkb )
185
186
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 ())
190
194
}
191
195
}
192
196
info .ProtocolVersion = identify .LibP2PVersion
Original file line number Diff line number Diff line change @@ -298,10 +298,11 @@ var swarmAddrsLocalCmd = &cmds.Command{
298
298
}
299
299
300
300
var addrs []string
301
+ p2pProtocolName := ma .ProtocolWithCode (ma .P_P2P ).Name
301
302
for _ , addr := range maddrs {
302
303
saddr := addr .String ()
303
304
if showid {
304
- saddr = path .Join (saddr , "ipfs" , self .ID ().Pretty ())
305
+ saddr = path .Join (saddr , p2pProtocolName , self .ID ().Pretty ())
305
306
}
306
307
addrs = append (addrs , saddr )
307
308
}
You can’t perform that action at this time.
0 commit comments