2016-08-26 04:51:09 +00:00
|
|
|
package bencode
|
|
|
|
|
|
|
|
type Bytes []byte
|
|
|
|
|
|
|
|
var (
|
2021-09-18 02:36:25 +00:00
|
|
|
_ Unmarshaler = (*Bytes)(nil)
|
|
|
|
_ Marshaler = (*Bytes)(nil)
|
2016-08-26 10:29:29 +00:00
|
|
|
_ Marshaler = Bytes{}
|
2016-08-26 04:51:09 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func (me *Bytes) UnmarshalBencode(b []byte) error {
|
|
|
|
*me = append([]byte(nil), b...)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2016-08-26 10:29:29 +00:00
|
|
|
func (me Bytes) MarshalBencode() ([]byte, error) {
|
|
|
|
return me, nil
|
2016-08-26 04:51:09 +00:00
|
|
|
}
|