]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Add peer_protocol.Integer.Int()
authorMatt Joiner <anacrolix@gmail.com>
Sun, 21 Feb 2016 06:25:26 +0000 (17:25 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 21 Feb 2016 06:25:26 +0000 (17:25 +1100)
peer_protocol/protocol.go

index ac958930c1815147e14c9fbc4066567e5e9f287a..da45d6772dc60f612e3a15b390aae7f4f6cb1aef 100644 (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"
 )