提交 2d16d252 作者: Juan Batiz-Benet

Merge pull request #848 from techfreek/master

peer short tags are improved
...@@ -5,6 +5,7 @@ import ( ...@@ -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{} { ...@@ -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)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论