peer_protocol/protocol.go | 8 ++++++++ diff --git a/peer_protocol/protocol.go b/peer_protocol/protocol.go index 8f914591111d4afdfdb1b0fe12a19a933c69f18c..13d76def401226910ac9aa8232f9500aaabc369e 100644 --- a/peer_protocol/protocol.go +++ b/peer_protocol/protocol.go @@ -1,5 +1,7 @@ package peer_protocol +import "strconv" + const ( Protocol = "\x13BitTorrent protocol" ) @@ -7,6 +9,12 @@ type ( MessageType byte ) + +// Hopefully uncaught panics format using this so we don't just see a pair of +// unhelpful uintptrs. +func (me MessageType) String() string { + return strconv.FormatInt(int64(me), 10) +} const ( Choke MessageType = iota