Documentation
¶
Index ¶
- Constants
- Variables
- func Encode(o *BNode, writer io.Writer) (int, error)
- func MarshalBen(w io.Writer, v interface{}) int
- func OrderIter(mp BDict) iter.Seq2[string, BObject]
- func PrintBobj(b BObject, tab string)
- func UnmarshalBen(r io.Reader, receiver interface{}) error
- type BDict
- type BInt
- type BList
- type BNode
- type BObject
- type BStr
- type Btype
Constants ¶
View Source
const BTag = "bencode"
Variables ¶
View Source
var ( ErrNum = errors.New("expect num") ErrCol = errors.New("expect colon") ErrEpI = errors.New("expect char i") ErrEpE = errors.New("expect char e") ErrTyp = errors.New("wrong type") ErrIvd = errors.New("invalid bencode") ErrEncode = errors.New("unexpect error while encoding") ErrMarshal = errors.New("marshal dst must be struct or slice ptr") ErrParse = errors.New("parse torrent file failed") )
Functions ¶
func MarshalBen ¶
func UnmarshalBen ¶
r: bencode字符串或者文件的读取流 receiver: 接收者,可以是int|string|map[string]*Bobject|[]*Bobject
Types ¶
type BNode ¶
type BNode struct {
// contains filtered or unexported fields
}
func DecodeFromFile ¶
func DecodeFromString ¶
Click to show internal directories.
Click to hide internal directories.