status-go/vendor/github.com/anacrolix/dht/v2/krpc/compact-infohashes.go

24 lines
544 B
Go
Raw Normal View History

2022-03-10 09:44:48 +00:00
package krpc
type Infohash [20]byte
type CompactInfohashes [][20]byte
func (CompactInfohashes) ElemSize() int { return 20 }
func (me CompactInfohashes) MarshalBinary() ([]byte, error) {
return marshalBinarySlice(me)
}
func (me CompactInfohashes) MarshalBencode() ([]byte, error) {
return bencodeBytesResult(me.MarshalBinary())
}
func (me *CompactInfohashes) UnmarshalBinary(b []byte) error {
return unmarshalBinarySlice(me, b)
}
func (me *CompactInfohashes) UnmarshalBencode(b []byte) error {
return unmarshalBencodedBinary(me, b)
}