swarm: more robust logic in remote address printing
Handles p2p-circuit addresses and any other address that uses a similar routing scheme. License: MIT Signed-off-by: vyzo <vyzo@hackzen.org>
vyzo committed
Jul 29, 2017 at 12:49 UTC
6c63cec719bfa4a000d5bc35c0b14ae8b8883aa9
1 file changed
+1
-1
core/commands/swarm.go
+1
-1
@@ -129,7 +129,7 @@ var swarmPeersCmd = &cmds.Command{
129
130
buf := new(bytes.Buffer)
131
for _, info := range ci.Peers {
132
- if strings.Contains(info.Addr, "/p2p-circuit/") {
132
+ if strings.HasSuffix(info.Addr, fmt.Sprintf("/ipfs/%s", info.Peer)) {
133
fmt.Fprintf(buf, "%s", info.Addr)
134
} else {
135
fmt.Fprintf(buf, "%s/ipfs/%s", info.Addr, info.Peer)