1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-30 01:52:26 +08:00

Merge pull request #848 from techfreek/master

peer short tags are improved
This commit is contained in:
Juan Batiz-Benet
2015-03-04 16:02:46 -08:00

View File

@ -5,6 +5,7 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"strings"
b58 "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-base58"
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
@ -38,6 +39,13 @@ func (id ID) Loggable() map[string]interface{} {
// codebase is known to be correct.
func (id ID) String() string {
pid := id.Pretty()
//All sha256 nodes start with Qm
//We can skip the Qm to make the peer.ID more useful
if strings.HasPrefix(pid, "Qm") {
pid = pid[2:]
}
maxRunes := 6
if len(pid) < maxRunes {
maxRunes = len(pid)