mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-30 18:13:54 +08:00
Merge pull request #848 from techfreek/master
peer short tags are improved
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
b58 "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-base58"
|
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"
|
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.
|
// codebase is known to be correct.
|
||||||
func (id ID) String() string {
|
func (id ID) String() string {
|
||||||
pid := id.Pretty()
|
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
|
maxRunes := 6
|
||||||
if len(pid) < maxRunes {
|
if len(pid) < maxRunes {
|
||||||
maxRunes = len(pid)
|
maxRunes = len(pid)
|
||||||
|
Reference in New Issue
Block a user