Documentation ¶
Overview ¶
bep_0012: announce-list bep_0030: Merkle hash torrent extension.
Index ¶
- Constants
- Variables
- type BEncoder
- type Body
- func (body *Body) AddPart(k string, v *Body) error
- func (b *Body) AnnounceList(s []string)
- func (body *Body) BStr() []byte
- func (body *Body) Check() (f bool)
- func (body *Body) Delete(k string)
- func (body *Body) DeleteN(n int)
- func (body *Body) Dict(key string) *Body
- func (body *Body) DictN(n int) (k string, b *Body)
- func (body *Body) Edit(v interface{})
- func (body *Body) Encode() ([]byte, error)
- func (body *Body) Infohash() (r []byte, e error)
- func (body *Body) Len() int
- func (body *Body) List(n int) *Body
- func (body *Body) Type() int
- func (body *Body) Value() int64
Constants ¶
View Source
const ( Unknown = -100 DorLEnd = -1 // Dictionary or List end mark. DictType = 0 ListType = 1 IntValue = 2 ByteString = 3 // Actually byte string. MaxDepth = 10 )
Variables ¶
View Source
var ( ErrEncodeDepthTooGreat = errors.New("bencode: Bencode depth over than 10, it is abnormal!") ErrInvalidDictKey = errors.New("bencode: Dictionary's key must be byte string!") ErrTypeFrom = errors.New("bencode: Cannot be body after int or string.") ErrTooManyEnd = errors.New("bencode: Too many end.") )
View Source
var ( ErrInvalidBody = errors.New("bencode: Body did not pass Check().") ErrDictWithoutKey = errors.New("bencode: Dict need a key to add value.") ErrUnknownType = errors.New("bencode: Unknown type to add.") )
View Source
var (
ErrInfoNotFound = errors.New("bencode: Did not find Info to calc infohash.")
)
Functions ¶
This section is empty.
Types ¶
type BEncoder ¶
type BEncoder struct {
// contains filtered or unexported fields
}
func NewEncoder ¶
func NewEncoder() *BEncoder
type Body ¶
type Body struct {
// contains filtered or unexported fields
}
func NewEmptyList ¶
func NewEmptyList() *Body
func (*Body) AnnounceList ¶
Click to show internal directories.
Click to hide internal directories.