From: Matt Joiner Date: Sun, 21 Feb 2016 06:25:26 +0000 (+1100) Subject: Add peer_protocol.Integer.Int() X-Git-Tag: v1.0.0~870 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=380dc7a2b44659f4552a203bf62874b6c2da9b70;p=btrtrc.git Add peer_protocol.Integer.Int() --- diff --git a/peer_protocol/protocol.go b/peer_protocol/protocol.go index ac958930..da45d677 100644 --- a/peer_protocol/protocol.go +++ b/peer_protocol/protocol.go @@ -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" )