Add peer_protocol.Integer.Int()

This commit is contained in:
Matt Joiner 2016-02-21 17:25:26 +11:00
parent 5b443fb63d
commit 380dc7a2b4
1 changed files with 5 additions and 0 deletions

View File

@ -19,6 +19,11 @@ func (i *Integer) Read(r io.Reader) error {
return binary.Read(r, binary.BigEndian, i)
}
// It's perfectly fine to cast these to an int.
func (i Integer) Int() int {
return int(i)
}
const (
Protocol = "\x13BitTorrent protocol"
)