2
0
mirror of synced 2025-02-23 14:18:13 +00:00

Add peer_protocol.RequestSpec

This commit is contained in:
Matt Joiner 2018-07-12 09:16:17 +10:00
parent f5bd377941
commit 86ca9ffa7e
2 changed files with 9 additions and 0 deletions

View File

@ -26,6 +26,10 @@ func MakeCancelMessage(piece, offset, length Integer) Message {
}
}
func (msg Message) RequestSpec() RequestSpec {
return RequestSpec{msg.Index, msg.Begin, msg.Length}
}
func (msg Message) MustMarshalBinary() []byte {
b, err := msg.MarshalBinary()
if err != nil {

5
peer_protocol/reqspec.go Normal file
View File

@ -0,0 +1,5 @@
package peer_protocol
type RequestSpec struct {
Index, Begin, Length Integer
}