Documentation ¶
Index ¶
- Variables
- func DecodeInfohash(r io.Reader) (hash string, err error)
- type FileInfo
- type FilePath
- type Info
- type TorrentFile
- func (tf *TorrentFile) Decode(r io.Reader) (err error)
- func (tf *TorrentFile) Encode(w io.Writer) (err error)
- func (tf *TorrentFile) GetAllAnnounceURLS() (l []string)
- func (tf *TorrentFile) IsPrivate() bool
- func (tf *TorrentFile) IsSingleFile() bool
- func (tf *TorrentFile) TorrentName() string
- func (tf *TorrentFile) TotalSize() uint64
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidTorrentFile = errors.New("torrent_file_invalid")
ErrInvalidTorrentFile : error for indicating we have an invalid torrent file
Functions ¶
Types ¶
type FileInfo ¶
type FileInfo struct { // length of file Length uint64 `bencode:"length"` // relative path of file Path FilePath `bencode:"path"` // md5sum Sum []byte `bencode:"md5sum,omitempty"` }
FileInfo struct
type Info ¶
type Info struct { // length of pices in bytes PieceLength uint32 `bencode:"piece length"` // piece data Pieces []byte `bencode:"pieces"` // name of root file Path string `bencode:"name"` // file metadata Files []FileInfo `bencode:"files,omitempty"` // private torrent Private *int64 `bencode:"private,omitempty"` // length of file in signle file mode Length uint64 `bencode:"length,omitempty"` // md5sum Sum []byte `bencode:"md5sum,omitempty"` }
Info : info section of torrent file
type TorrentFile ¶
type TorrentFile struct { Info Info `bencode:"info"` Announce string `bencode:"announce"` AnnounceList [][]string `bencode:"announce-list"` Created uint64 `bencode:"created"` Comment []byte `bencode:"comment"` CreatedBy []byte `bencode:"created by"` Encoding []byte `bencode:"encoding"` }
TorrentFile : a torrent file
func (*TorrentFile) Decode ¶
func (tf *TorrentFile) Decode(r io.Reader) (err error)
Decode : load from an io.Reader
func (*TorrentFile) Encode ¶
func (tf *TorrentFile) Encode(w io.Writer) (err error)
Encode : bencode this file via an io.Writer
func (*TorrentFile) GetAllAnnounceURLS ¶
func (tf *TorrentFile) GetAllAnnounceURLS() (l []string)
GetAllAnnounceURLS : get all trackers url
func (*TorrentFile) IsPrivate ¶
func (tf *TorrentFile) IsPrivate() bool
IsPrivate : return true if this torrent is private otherwise return false
func (*TorrentFile) IsSingleFile ¶
func (tf *TorrentFile) IsSingleFile() bool
IsSingleFile : return true if this torrent is for a single file
func (*TorrentFile) TorrentName ¶
func (tf *TorrentFile) TorrentName() string
TorrentName : return torrent name
func (*TorrentFile) TotalSize ¶
func (tf *TorrentFile) TotalSize() uint64
TotalSize : get total size of files from torrent info section
Click to show internal directories.
Click to hide internal directories.