Add some helpful comments to type PeerID
This commit is contained in:
parent
51b3374015
commit
d5f8440e7e
|
@ -4,8 +4,11 @@ import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Peer client ID.
|
||||||
type PeerID [20]byte
|
type PeerID [20]byte
|
||||||
|
|
||||||
|
// Pretty prints the ID as hex, except parts that adher to the Peer ID
|
||||||
|
// Conventions of BEP 20.
|
||||||
func (me PeerID) String() string {
|
func (me PeerID) String() string {
|
||||||
if me[0] == '-' && me[7] == '-' {
|
if me[0] == '-' && me[7] == '-' {
|
||||||
return string(me[:8]) + hex.EncodeToString(me[8:])
|
return string(me[:8]) + hex.EncodeToString(me[8:])
|
||||||
|
|
Loading…
Reference in New Issue