Add bencode.Bytes

This commit is contained in:
Matt Joiner 2016-08-26 14:51:09 +10:00
parent f2cbc873a5
commit ebdab2d9de
1 changed files with 17 additions and 0 deletions

17
bencode/bytes.go Normal file
View File

@ -0,0 +1,17 @@
package bencode
type Bytes []byte
var (
_ Unmarshaler = &Bytes{}
_ Marshaler = &Bytes{}
)
func (me *Bytes) UnmarshalBencode(b []byte) error {
*me = append([]byte(nil), b...)
return nil
}
func (me *Bytes) MarshalBencode() ([]byte, error) {
return *me, nil
}