Skip to content

Commit

Permalink
swarm: more robust logic in remote address printing
Browse files Browse the repository at this point in the history
Handles p2p-circuit addresses and any other address that uses a similar
routing scheme.

License: MIT
Signed-off-by: vyzo <[email protected]>
  • Loading branch information
vyzo committed Jul 29, 2017
1 parent e9fa416 commit ae3c6d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/commands/swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ var swarmPeersCmd = &cmds.Command{

buf := new(bytes.Buffer)
for _, info := range ci.Peers {
if strings.Contains(info.Addr, "/p2p-circuit/") {
if strings.HasSuffix(info.Addr, fmt.Sprintf("/ipfs/%s", info.Peer)) {
fmt.Fprintf(buf, "%s", info.Addr)
} else {
fmt.Fprintf(buf, "%s/ipfs/%s", info.Addr, info.Peer)
Expand Down

0 comments on commit ae3c6d6

Please sign in to comment.