Documentation
¶
Index ¶
- Constants
- Variables
- type File
- func (f *File) Buffer(startBufferSize, endBufferSize int64)
- func (f *File) BufferBytesCompleted() int64
- func (f *File) BufferBytesMissing() int64
- func (f *File) BufferLength() int64
- func (f *File) BytesCompleted() int64
- func (f *File) GetBufferingProgress() float64
- func (f *File) GetDownloadPath() string
- func (f *File) GetProgress() float64
- func (f *File) GetState() LTStatus
- func (f *File) Id() int
- func (f *File) Info() *FileInfo
- func (f *File) IsDownloading() bool
- func (f *File) Length() int64
- func (f *File) Name() string
- func (f *File) NewReader() *reader
- func (f *File) Path() string
- func (f *File) SetPriority(priority uint)
- func (f *File) Status() *FileStatus
- type FileInfo
- type FileStatus
- type LTStatus
- type Magnet
- type Service
- func (s *Service) AddMagnet(magnet string, download bool) (infoHash string, err error)
- func (s *Service) AddTorrentData(data []byte, download bool) (infoHash string, err error)
- func (s *Service) AddTorrentFile(torrentFile string, download bool) (infoHash string, err error)
- func (s *Service) Close()
- func (s *Service) GetStatus() *ServiceStatus
- func (s *Service) GetTorrent(infoHash string) (*Torrent, error)
- func (s *Service) Pause()
- func (s *Service) Reconfigure(config *settings.Settings, reset bool)
- func (s *Service) RemoveTorrent(infoHash string, removeFiles bool) error
- func (s *Service) Resume()
- func (s *Service) Torrents() []*Torrent
- type ServiceStatus
- type Torrent
- func (t *Torrent) Files() ([]*File, error)
- func (t *Torrent) GetFile(id int) (*File, error)
- func (t *Torrent) GetInfo() *TorrentInfo
- func (t *Torrent) GetState() LTStatus
- func (t *Torrent) GetStatus() *TorrentStatus
- func (t *Torrent) HasMetadata() bool
- func (t *Torrent) InfoHash() string
- func (t *Torrent) Pause()
- func (t *Torrent) Resume()
- func (t *Torrent) SetPriority(priority uint) error
- type TorrentFileRaw
- type TorrentInfo
- type TorrentStatus
Constants ¶
View Source
const ( DontDownloadPriority = uint(0) LowPriority = uint(1) DefaultPriority = uint(4) HighPriority = uint(6) TopPriority = uint(7) )
noinspection GoUnusedConst
Variables ¶
View Source
var ( DuplicateTorrentError = errors.New("torrent was previously added") LoadTorrentError = errors.New("failed loading torrent") InvalidInfoHashError = errors.New("no such info hash") InvalidFileIdError = errors.New("no such file id") ServiceClosedError = errors.New("service was closed") TorrentClosedError = errors.New("torrent was closed") TorrentPausedError = errors.New("torrent paused") ReaderClosedError = errors.New("reader was closed") ReaderCloseNotifyError = errors.New("reader close notify received") InvalidWhenceError = errors.New("invalid whence") TimeoutError = errors.New("timeout reached") NoMetadataError = errors.New("no metadata") )
View Source
var DefaultDhtBootstrapNodes = []string{
"router.utorrent.com:6881",
"router.bittorrent.com:6881",
"dht.transmissionbt.com:6881",
"dht.aelitis.com:6881",
"router.silotis.us:6881",
"dht.libtorrent.org:25401",
}
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
func (*File) BufferBytesCompleted ¶ added in v0.0.3
func (*File) BufferBytesMissing ¶ added in v0.0.3
func (*File) BufferLength ¶ added in v0.0.3
func (*File) BytesCompleted ¶
func (*File) GetBufferingProgress ¶
func (*File) GetDownloadPath ¶
func (*File) GetProgress ¶
func (*File) IsDownloading ¶
func (*File) SetPriority ¶
func (*File) Status ¶
func (f *File) Status() *FileStatus
type FileStatus ¶
type LTStatus ¶
type LTStatus int
const ( QueuedStatus LTStatus = iota // libtorrent.TorrentStatusUnusedEnumForBackwardsCompatibility CheckingStatus // libtorrent.TorrentStatusCheckingFiles FindingStatus // libtorrent.TorrentStatusDownloadingMetadata DownloadingStatus // libtorrent.TorrentStatusDownloading FinishedStatus // libtorrent.TorrentStatusFinished SeedingStatus // libtorrent.TorrentStatusSeeding AllocatingStatus // libtorrent.TorrentStatusAllocating CheckingResumeDataStatus // libtorrent.TorrentStatusCheckingResumeData // Custom status PausedStatus BufferingStatus )
noinspection GoUnusedConst
type Service ¶
type Service struct { UserAgent string // contains filtered or unexported fields }
Service represents the torrent service
func NewService ¶
NewService creates a service given the provided configs
func (*Service) AddTorrentData ¶
func (*Service) AddTorrentFile ¶
func (*Service) GetStatus ¶
func (s *Service) GetStatus() *ServiceStatus
func (*Service) RemoveTorrent ¶
type ServiceStatus ¶
type Torrent ¶
type Torrent struct {
// contains filtered or unexported fields
}
func NewTorrent ¶
func (*Torrent) GetInfo ¶
func (t *Torrent) GetInfo() *TorrentInfo
func (*Torrent) GetStatus ¶
func (t *Torrent) GetStatus() *TorrentStatus
func (*Torrent) HasMetadata ¶
func (*Torrent) SetPriority ¶
type TorrentFileRaw ¶
type TorrentFileRaw struct { Announce string `bencode:"announce"` AnnounceList [][]string `bencode:"announce-list"` Info map[string]interface{} `bencode:"info"` }
func DecodeTorrentData ¶
func DecodeTorrentData(data []byte) (*TorrentFileRaw, error)
type TorrentInfo ¶
type TorrentStatus ¶
type TorrentStatus struct { Total int64 `json:"total"` TotalDone int64 `json:"total_done"` TotalWanted int64 `json:"total_wanted"` TotalWantedDone int64 `json:"total_wanted_done"` Progress float64 `json:"progress"` DownloadRate int `json:"download_rate"` UploadRate int `json:"upload_rate"` Paused bool `json:"paused"` HasMetadata bool `json:"has_metadata"` State LTStatus `json:"state"` Seeders int `json:"seeders"` SeedersTotal int `json:"seeders_total"` Peers int `json:"peers"` PeersTotal int `json:"peers_total"` SeedingTime int64 `json:"seeding_time"` FinishedTime int64 `json:"finished_time"` ActiveTime int64 `json:"active_time"` AllTimeDownload int64 `json:"all_time_download"` AllTimeUpload int64 `json:"all_time_upload"` }
Click to show internal directories.
Click to hide internal directories.