mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-05 23:53:19 +08:00
don't hardcode ipfs protocol name in multiaddr display
License: MIT Signed-off-by: vyzo <vyzo@hackzen.org>
This commit is contained in:
@ -128,11 +128,13 @@ var swarmPeersCmd = &cmds.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
|
pipfs := ma.ProtocolWithCode(ma.P_IPFS)
|
||||||
for _, info := range ci.Peers {
|
for _, info := range ci.Peers {
|
||||||
if strings.HasSuffix(info.Addr, fmt.Sprintf("/ipfs/%s", info.Peer)) {
|
ids := fmt.Sprintf("/%s/%s", pipfs.Name, info.Peer)
|
||||||
|
if strings.HasSuffix(info.Addr, ids) {
|
||||||
fmt.Fprintf(buf, "%s", info.Addr)
|
fmt.Fprintf(buf, "%s", info.Addr)
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(buf, "%s/ipfs/%s", info.Addr, info.Peer)
|
fmt.Fprintf(buf, "%s%s", info.Addr, ids)
|
||||||
}
|
}
|
||||||
if info.Latency != "" {
|
if info.Latency != "" {
|
||||||
fmt.Fprintf(buf, " %s", info.Latency)
|
fmt.Fprintf(buf, " %s", info.Latency)
|
||||||
|
Reference in New Issue
Block a user