Add bencode.Bytes
This commit is contained in:
parent
f2cbc873a5
commit
ebdab2d9de
|
@ -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
|
||||
}
|
Loading…
Reference in New Issue