2018-01-06 01:34:31 +00:00
|
|
|
package torrent
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/hex"
|
|
|
|
)
|
|
|
|
|
2018-01-06 04:50:45 +00:00
|
|
|
type PeerID [20]byte
|
2018-01-06 01:34:31 +00:00
|
|
|
|
2018-01-06 04:50:45 +00:00
|
|
|
func (me PeerID) String() string {
|
2018-01-06 01:34:31 +00:00
|
|
|
if me[0] == '-' && me[7] == '-' {
|
|
|
|
return string(me[:8]) + hex.EncodeToString(me[8:])
|
|
|
|
}
|
|
|
|
return hex.EncodeToString(me[:])
|
|
|
|
}
|