Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
8d928334
Commit
8d928334
authored
Feb 10, 2016
by
Jeromy
Browse files
make PeerInfo loggable
parent
9600c039
Changes
1
Hide whitespace changes
Inline
Side-by-side
p2p/peer/peer.go
View file @
8d928334
...
@@ -141,6 +141,13 @@ type PeerInfo struct {
...
@@ -141,6 +141,13 @@ type PeerInfo struct {
Addrs
[]
ma
.
Multiaddr
Addrs
[]
ma
.
Multiaddr
}
}
func
(
pi
*
PeerInfo
)
Loggable
()
map
[
string
]
interface
{}
{
return
map
[
string
]
interface
{}{
"peerID"
:
pi
.
ID
.
Pretty
(),
"addrs"
:
pi
.
Addrs
,
}
}
func
(
pi
*
PeerInfo
)
MarshalJSON
()
([]
byte
,
error
)
{
func
(
pi
*
PeerInfo
)
MarshalJSON
()
([]
byte
,
error
)
{
out
:=
make
(
map
[
string
]
interface
{})
out
:=
make
(
map
[
string
]
interface
{})
out
[
"ID"
]
=
IDB58Encode
(
pi
.
ID
)
out
[
"ID"
]
=
IDB58Encode
(
pi
.
ID
)
...
...
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