Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
2d16d252
Commit
2d16d252
authored
Mar 04, 2015
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #848 from techfreek/master
peer short tags are improved
parents
014f0108
da80f22b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
p2p/peer/peer.go
p2p/peer/peer.go
+8
-0
No files found.
p2p/peer/peer.go
View file @
2d16d252
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment