compact-infohashes.go 544 B

1234567891011121314151617181920212223
  1. package krpc
  2. type Infohash [20]byte
  3. type CompactInfohashes [][20]byte
  4. func (CompactInfohashes) ElemSize() int { return 20 }
  5. func (me CompactInfohashes) MarshalBinary() ([]byte, error) {
  6. return marshalBinarySlice(me)
  7. }
  8. func (me CompactInfohashes) MarshalBencode() ([]byte, error) {
  9. return bencodeBytesResult(me.MarshalBinary())
  10. }
  11. func (me *CompactInfohashes) UnmarshalBinary(b []byte) error {
  12. return unmarshalBinarySlice(me, b)
  13. }
  14. func (me *CompactInfohashes) UnmarshalBencode(b []byte) error {
  15. return unmarshalBencodedBinary(me, b)
  16. }