From 380dc7a2b44659f4552a203bf62874b6c2da9b70 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Sun, 21 Feb 2016 17:25:26 +1100 Subject: [PATCH] Add peer_protocol.Integer.Int() --- peer_protocol/protocol.go | 5 +++++ 1 file changed, 5 insertions(+) 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" )