Documentation ¶
Index ¶
- type AnnounceURL
- type File
- type FileParser
- type InfoDict
- func (info *InfoDict) Bytes(filename string) ([]byte, error)
- func (info *InfoDict) FilesInfo() []File
- func (info *InfoDict) NumPieces() int
- func (info *InfoDict) Parse() error
- func (info *InfoDict) PieceHash(i int) []byte
- func (info *InfoDict) PieceLength(i int) int
- func (info *InfoDict) PieceOffset(i int) int64
- func (info *InfoDict) PiecesHash() [][]byte
- func (info *InfoDict) TotalLength() (total int)
- type InfoHashParser
- type MagnetParser
- type MetaInfo
- type Parser
- type ReaderParser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnnounceURL ¶
type AnnounceURL string
type File ¶
type File struct { Len int `bencode:"length"` Md5 []byte `bencode:"md5sum" empty:"omit"` Path []string `bencode:"path"` }
File contains information about a specific file in a .torrent file.
type FileParser ¶
type FileParser struct {
Filename string
}
FileParser parses a file with name Filename
func (*FileParser) Parse ¶
func (fp *FileParser) Parse() (*MetaInfo, error)
type InfoDict ¶
type InfoDict struct { Files []File `bencode:"files" empty:"omit"` Len int `bencode:"length" empty:"omit"` Md5 []byte `bencode:"md5sum" empty:"omit"` Name string `bencode:"name" empty:"omit"` PieceLen int `bencode:"piece length"` Pieces []byte `bencode:"pieces"` Private int `bencode:"private" empty:"omit"` //store info hash - we dont want to compute it every time Hash [20]byte `bencode:"-"` }
InfoDict contains all the basic information about about the files that the .torrent file is mentioning.
func (*InfoDict) Bytes ¶
Bytes returns the info dict in bencoded form. `filename` is a .torrent file
func (*InfoDict) PieceLength ¶
func (*InfoDict) PieceOffset ¶
func (*InfoDict) PiecesHash ¶
func (*InfoDict) TotalLength ¶
type InfoHashParser ¶
type InfoHashParser struct {
InfoHash [20]byte
}
func (*InfoHashParser) Parse ¶
func (ip *InfoHashParser) Parse() (*MetaInfo, error)
type MagnetParser ¶
type MagnetParser struct {
URI string
}
MagnetParser parses an URI
func (*MagnetParser) Parse ¶
func (mp *MagnetParser) Parse() (*MetaInfo, error)
type MetaInfo ¶
type MetaInfo struct { Announce string `bencode:"announce"` AnnounceList [][]string `bencode:"announce-list" empty:"omit"` Comment string `bencode:"comment" empty:"omit"` Created string `bencode:"created by" empty:"omit"` CreationDate int `bencode:"creation date" empty:"omit"` Encoding string `bencode:"encoding" empty:"omit"` Info *InfoDict `bencode:"info"` InfoBytes []byte `bencode:"-"` }
func LoadMetainfoFile ¶
func (*MetaInfo) CreateTorrentFile ¶
type ReaderParser ¶
func (*ReaderParser) Parse ¶
func (rp *ReaderParser) Parse() (*MetaInfo, error)
Parse reads until EOF from R and then parses the read bytes
Click to show internal directories.
Click to hide internal directories.