]> Sergey Matveev's repositories - btrtrc.git/blob - peerid.go
Use peerID type more, and make its Stringer output nicer
[btrtrc.git] / peerid.go
1 package torrent
2
3 import (
4         "encoding/hex"
5 )
6
7 type peerID [20]byte
8
9 func (me peerID) String() string {
10         if me[0] == '-' && me[7] == '-' {
11                 return string(me[:8]) + hex.EncodeToString(me[8:])
12         }
13         return hex.EncodeToString(me[:])
14 }