Documentation
¶
Index ¶
- type BitTorrentFile
- func (tf *BitTorrentFile) GetInfoSection() (is models.Dictionary, err error)
- func (tf *BitTorrentFile) GetSection(sectionName string) (result any, err error)
- func (tf *BitTorrentFile) GetSectionValueAsArrayOfStringArrays(sectionName string) (asa [][]string, err error)
- func (tf *BitTorrentFile) GetSectionValueAsInt(sectionName string) (i int, err error)
- func (tf *BitTorrentFile) GetSectionValueAsString(sectionName string) (sv string, err error)
- func (tf *BitTorrentFile) GetSectionValueAsStringArray(sectionName string) (sa []string, err error)
- func (tf *BitTorrentFile) Open() (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BitTorrentFile ¶
type BitTorrentFile struct {
// Source is a file which is being parsed.
Source *b.File
// Decoded raw data.
RawData *b.DecodedObject
// IsBroken is a marker of a broken file.
// Some stupid people think that specifications were created for fools and
// that they [these stupid people] are better than other people. We mark
// such idiots with this flag.
IsBroken bool
// Version of the BitTorrent File.
// It can be numeric or textual while there are some crazy things such as
// the 'Hybrid' file format.
Version models.Version
// BitTorrent name.
// This field is supported by the second BitTorrent protocol specification.
Name string
// BitTorrent Info Hash.
// The original first version of info hash.
BTIH mhash.BtihData
// New BitTorrent Info Hash.
// Second version of info hash.
BTIH2 mhash.BtihData2
// List of announce URLs of trackers described in the BitTorrent File.
AnnounceUrlMain models.AnnounceAddress
AnnounceUrlsAux [][]models.AnnounceAddress
// Creation time of the BitTorrent File.
CreationTime time.Time
// Comment of the BitTorrent File.
Comment string
// Creator of the BitTorrent File.
Creator string
// String encoding format used to generate the 'pieces' field of the 'info'
// dictionary of the BitTorrent File.
Encoding string
// List of files described in the BitTorrent File.
Files []models.File
}
BitTorrentFile is a BitTorrent file.
func NewBitTorrentFile ¶
func NewBitTorrentFile(filePath string) (tf *BitTorrentFile)
NewBitTorrentFile is a constructor of the BitTorrentFile object.
func (*BitTorrentFile) GetInfoSection ¶
func (tf *BitTorrentFile) GetInfoSection() (is models.Dictionary, err error)
GetInfoSection gets an 'info' section from the object.
func (*BitTorrentFile) GetSection ¶
func (tf *BitTorrentFile) GetSection(sectionName string) (result any, err error)
GetSection gets a section specified by its name from the object.
func (*BitTorrentFile) GetSectionValueAsArrayOfStringArrays ¶
func (tf *BitTorrentFile) GetSectionValueAsArrayOfStringArrays(sectionName string) (asa [][]string, err error)
GetSectionValueAsArrayOfStringArrays reads section value and returns it as array of string arrays.
func (*BitTorrentFile) GetSectionValueAsInt ¶
func (tf *BitTorrentFile) GetSectionValueAsInt(sectionName string) (i int, err error)
GetSectionValueAsInt reads section value and returns it as int.
func (*BitTorrentFile) GetSectionValueAsString ¶
func (tf *BitTorrentFile) GetSectionValueAsString(sectionName string) (sv string, err error)
GetSectionValueAsString reads section value and returns it as string.
func (*BitTorrentFile) GetSectionValueAsStringArray ¶
func (tf *BitTorrentFile) GetSectionValueAsStringArray(sectionName string) (sa []string, err error)
GetSectionValueAsStringArray reads section value and returns it as string array.
func (*BitTorrentFile) Open ¶
func (tf *BitTorrentFile) Open() (err error)
Open opens an existing BitTorrent file and parses it.
Click to show internal directories.
Click to hide internal directories.